Skip to content

Commit f4798b9

Browse files
authored
backupformat: strip prefixes w/ empty replacement (#620)
1 parent 8548304 commit f4798b9

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pkg/backupformat/rewriter.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,9 @@ type PrefixReplacer struct {
184184
func (pr *PrefixReplacer) replaceName(name string) string {
185185
prefix, prefixlessName, prefixExists := strings.Cut(name, "/")
186186
if newPrefix, ok := pr.replacements[prefix]; prefixExists && ok {
187+
if newPrefix == "" {
188+
return prefixlessName
189+
}
187190
return newPrefix + "/" + prefixlessName
188191
}
189192
return name

0 commit comments

Comments
 (0)