Normalize local backend repository path with filepath.Join - #10
Open
anisurrahman75 wants to merge 1 commit into
Open
Normalize local backend repository path with filepath.Join#10anisurrahman75 wants to merge 1 commit into
anisurrahman75 wants to merge 1 commit into
Conversation
The ProviderLocal branch built RESTIC_REPOSITORY via fmt.Sprintf("%s/%s", b.Bucket, b.Directory),
which inserts a redundant separator when b.Directory already begins with '/'
(e.g. "/safe/data" + "/pvc-local" => "/safe/data//pvc-local"). The S3/Azure/GCS
branches already use filepath.Join, which normalizes the path; do the same for local
so the repository path is clean and consistent across providers.
Signed-off-by: Anisur Rahman <anisur@appscode.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
ProviderLocalbranch insetup.gobuiltRESTIC_REPOSITORYwith:This unconditionally inserts a
/separator. Whenb.Directoryalready begins with a/(e.g. a repositorydirectory: /pvc-local), the result contains a redundant double slash:The
S3,Azure, andGCSbranches already usefilepath.Join, which normalizes and collapses redundant separators. This change makes the local branch consistent:Impact
Cosmetic/robustness. POSIX and restic treat
//and/as equivalent, so this was not a functional failure, but the double slash showed up verbatim in log lines and error messages (Is there a repository at the following location? /safe/data//...), which was confusing during debugging of local (PVC/NFS) backends.Testing
go build ./...,go vet ./...clean.go test ./...passes.