diff --git a/internal/archiver/archiver_unix.go b/internal/archiver/archiver_unix.go index 4309bb36b..3b42dcd72 100644 --- a/internal/archiver/archiver_unix.go +++ b/internal/archiver/archiver_unix.go @@ -19,7 +19,13 @@ func preProcessTargets(_ fs.FS, _ *[]string) { // processTarget processes each target in the loop. // In case of non-windows OS it uses the passed filesys to clean the target. func processTarget(filesys fs.FS, target string) string { - return filesys.Clean(target) + if target != "" && filesys.VolumeName(target) == target { + // special case to allow users to also specify a volume name "C:" instead of a path "C:\" + target = target + filesys.Separator() + } else { + target = filesys.Clean(target) + } + return target } // preProcessPaths processes paths before looping. diff --git a/internal/archiver/archiver_windows.go b/internal/archiver/archiver_windows.go index 719ce5fa5..bf997ea1b 100644 --- a/internal/archiver/archiver_windows.go +++ b/internal/archiver/archiver_windows.go @@ -31,7 +31,11 @@ func preProcessTargets(filesys fs.FS, targets *[]string) { // processTarget processes each target in the loop. // In case of windows the clean up of target is already done // in preProcessTargets before the loop, hence this is no-op. -func processTarget(_ fs.FS, target string) string { +func processTarget(filesys fs.FS, target string) string { + if target != "" && filesys.VolumeName(target) == target { + // special case to allow users to also specify a volume name "C:" instead of a path "C:\" + target = target + filesys.Separator() + } return target }