added download crashing when creating logfile with unwanted characters
This commit is contained in:
parent
800b82b7bd
commit
17c85f9280
1 changed files with 3 additions and 1 deletions
|
|
@ -210,7 +210,9 @@ class DownloadWorker(
|
|||
runCatching {
|
||||
val logDownloads = sharedPreferences.getBoolean("log_downloads", false) && !sharedPreferences.getBoolean("incognito", false)
|
||||
val logFolder = File(context.filesDir.absolutePath + "/logs")
|
||||
val logFile = File(context.filesDir.absolutePath + """/logs/${downloadItem.id} - ${downloadItem.title}##${downloadItem.type}##${downloadItem.format.format_id}.log""")
|
||||
val regex = Regex("[^A-Za-z\\d ]")
|
||||
val logFile = File(context.filesDir.absolutePath + """/logs/${downloadItem.id} - ${regex.replace(downloadItem.title, "")}##${downloadItem.type}##${downloadItem.format.format_id}.log""")
|
||||
Log.e("aa", logFile.name)
|
||||
if (logDownloads){
|
||||
logFolder.mkdirs()
|
||||
logFile.createNewFile()
|
||||
|
|
|
|||
Loading…
Reference in a new issue