From fb34336e6b0f610f6af3f434d2bb0c86231d5c64 Mon Sep 17 00:00:00 2001 From: Nulo Date: Tue, 9 May 2023 17:57:42 -0300 Subject: [PATCH] archiver: escape urls MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit so anything with spaces or áéíóúñ or any unicode will work --- sources/cmd/archiver/archiver.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sources/cmd/archiver/archiver.go b/sources/cmd/archiver/archiver.go index ac6e451..456bd4c 100644 --- a/sources/cmd/archiver/archiver.go +++ b/sources/cmd/archiver/archiver.go @@ -900,10 +900,22 @@ func prepareKeyString (_context *context, _namespace string, _fingerprint string } +func pathEscape (_path string) (final string) { + fragments := strings.Split(_path, "/") + for i, fragment := range fragments { + final = final + url.PathEscape(fragment) + if i != len(fragments) - 1 { + final = final + "/" + } + } + return +} func walkPath (_context *context, _pathResolved string, _pathInArchive string, _name string, _recursed map[string]uint, _recurse bool, _statusPerhaps uint) (os.FileInfo, error) { + _pathInArchive = pathEscape(_pathInArchive) + if _recursed == nil { _recursed = make (map[string]uint, 128) }