Replace dangerous characters in the filename with underscores
This commit is contained in:
parent
0f22dc610d
commit
d75b7434cf
@ -514,7 +514,7 @@ fun selectTxtFileToWrite(
|
||||
@Suppress("DEPRECATION")
|
||||
fun saveFileIntoLegacy(sourceFile: File, dstDirPath: File, outputFilename: String?): File? {
|
||||
// defines another name for the external media
|
||||
val dstFileName: String
|
||||
var dstFileName: String
|
||||
|
||||
// build a filename is not provided
|
||||
if (null == outputFilename) {
|
||||
@ -529,6 +529,9 @@ fun saveFileIntoLegacy(sourceFile: File, dstDirPath: File, outputFilename: Strin
|
||||
dstFileName = outputFilename
|
||||
}
|
||||
|
||||
// remove dangerous characters from the filename
|
||||
dstFileName = dstFileName.replace(Regex("""[/\\]"""), "_")
|
||||
|
||||
var dstFile = File(dstDirPath, dstFileName)
|
||||
|
||||
// if the file already exists, append a marker
|
||||
|
Loading…
x
Reference in New Issue
Block a user