#42 Allow deletion of ./*
This commit is contained in:

committed by
Sebastian Serth

parent
59ca63268b
commit
eecacc08bf
@ -253,12 +253,16 @@ func fileDeletionCommand(pathsToDelete []dto.FilePath) string {
|
||||
}
|
||||
command := "rm --recursive --force "
|
||||
for _, filePath := range pathsToDelete {
|
||||
if filePath == "./*" {
|
||||
command += "./* "
|
||||
} else {
|
||||
// To avoid command injection, filenames need to be quoted.
|
||||
// See https://unix.stackexchange.com/questions/347332/what-characters-need-to-be-escaped-in-files-without-quotes
|
||||
// for details.
|
||||
singleQuoteEscapedFileName := strings.ReplaceAll(filePath.Cleaned(), "'", "'\\''")
|
||||
command += fmt.Sprintf("'%s' ", singleQuoteEscapedFileName)
|
||||
}
|
||||
}
|
||||
command += ";"
|
||||
return command
|
||||
}
|
||||
|
Reference in New Issue
Block a user