...
1
2
3
4
5
6
7 package web
8
9 var urlTests = []struct {
10 url string
11 filePath string
12 canonicalURL string
13 wantErr string
14 }{
15
16 {
17 url: `file:///path/to/file`,
18 filePath: `/path/to/file`,
19 },
20 {
21 url: `file:/path/to/file`,
22 filePath: `/path/to/file`,
23 canonicalURL: `file:///path/to/file`,
24 },
25 {
26 url: `file://localhost/path/to/file`,
27 filePath: `/path/to/file`,
28 canonicalURL: `file:///path/to/file`,
29 },
30
31
32 {
33 url: `file://host.example.com/path/to/file`,
34 wantErr: "file URL specifies non-local host",
35 },
36 }
37
View as plain text