MCPcopy Index your code
hub / github.com/devspace-sh/devspace / isDestRelative

Function isDestRelative

pkg/devspace/hook/download.go:174–180  ·  view source on GitHub ↗

isDestRelative returns true if dest is pointing outside the base directory, false otherwise.

(base, dest string)

Source from the content-addressed store, hash-verified

172// isDestRelative returns true if dest is pointing outside the base directory,
173// false otherwise.
174func 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
183func stripPathShortcuts(p string) string {

Callers 1

untarAllFunction · 0.85

Calls 1

stripPathShortcutsFunction · 0.85

Tested by

no test coverage detected