JoinPath returns a SafeURL for the path made up of the given components. It returns an error if any component is exactly "..", which would traverse the URL path and change which resource it addresses.
(components ...string)
| 52 | // returns an error if any component is exactly "..", which would traverse the URL |
| 53 | // path and change which resource it addresses. |
| 54 | func JoinPath(components ...string) (*MutableSafeURL, error) { |
| 55 | if err := checkTraversal(components); err != nil { |
| 56 | return nil, err |
| 57 | } |
| 58 | return &MutableSafeURL{components: components}, nil |
| 59 | } |
| 60 | |
| 61 | // JoinPathWithHostPrefix returns a SafeURL for the given host prefix and the path |
| 62 | // made up of the given components. It returns an error if any component is exactly |