isDestRelative returns true if dest is pointing outside the base directory, false otherwise.
(base, dest string)
| 172 | // isDestRelative returns true if dest is pointing outside the base directory, |
| 173 | // false otherwise. |
| 174 | func isDestRelative(base, dest string) bool { |
| 175 | relative, err := filepath.Rel(base, dest) |
| 176 | if err != nil { |
| 177 | return false |
| 178 | } |
| 179 | return relative == "." || relative == stripPathShortcuts(relative) |
| 180 | } |
| 181 | |
| 182 | // stripPathShortcuts removes any leading or trailing "../" from a given path |
| 183 | func stripPathShortcuts(p string) string { |
no test coverage detected