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