MCPcopy Create free account
hub / github.com/dropbox/dbxcli / relativeTo

Function relativeTo

cmd/get.go:361–370  ·  view source on GitHub ↗
(base, full string)

Source from the content-addressed store, hash-verified

359}
360
361func relativeTo(base, full string) (string, error) {
362 baseLower := strings.ToLower(base)
363 fullLower := strings.ToLower(full)
364 if fullLower != baseLower && !strings.HasPrefix(fullLower, baseLower+"/") {
365 return "", fmt.Errorf("path %q is not under %q", full, base)
366 }
367 rel := full[len(base):]
368 rel = strings.TrimPrefix(rel, "/")
369 return rel, nil
370}
371
372func downloadFile(dbx filesClient, src string, dst string) error {
373 _, err := downloadFileWithMetadata(dbx, src, dst, os.Stderr)

Callers 3

TestRelativeToFunction · 0.85
getRecursiveInternalFunction · 0.85

Calls

no outgoing calls

Tested by 2

TestRelativeToFunction · 0.68