()
| 70 | } |
| 71 | |
| 72 | func (e PathTraversalError) Error() string { |
| 73 | if e.Base.path == "" { |
| 74 | path := filepath.Join(e.Elems...) |
| 75 | if len(e.Elems) == 1 { |
| 76 | path = e.Elems[0] |
| 77 | } |
| 78 | return fmt.Sprintf("path %q is not a local child path", path) |
| 79 | } |
| 80 | return fmt.Sprintf("joining %s and %s would be a traversal", e.Base, filepath.Join(e.Elems...)) |
| 81 | } |