(dir Absolute)
| 57 | } |
| 58 | |
| 59 | func (a Absolute) isSubpathOf(dir Absolute) (bool, error) { |
| 60 | relativePath, err := filepath.Rel(dir.path, a.path) |
| 61 | if err != nil { |
| 62 | return false, err |
| 63 | } |
| 64 | return !strings.HasPrefix(relativePath, ".."), nil |
| 65 | } |
| 66 | |
| 67 | type PathTraversalError struct { |
| 68 | Base Absolute |