Fix download issue caused by file name

This commit is contained in:
Krunal Patel 2022-11-27 19:23:45 +05:30
parent 2d74858935
commit 9257169bf3
2 changed files with 2 additions and 2 deletions

View File

@ -4,5 +4,5 @@ package com.github.libretube.extensions
* Replace file name specific chars * Replace file name specific chars
*/ */
fun String.sanitize(): String { fun String.sanitize(): String {
return this.replace("[^a-zA-Z0-9\\._]+", "_") return this.replace("[^a-zA-Z0-9\\\\._]+".toRegex(), "_")
} }

View File

@ -124,7 +124,7 @@ class DownloadDialog(
if (binding.audioSpinner.size >= 1) binding.audioSpinner.setSelection(1) if (binding.audioSpinner.size >= 1) binding.audioSpinner.setSelection(1)
binding.download.setOnClickListener { binding.download.setOnClickListener {
if (binding.fileName.text.toString().length < 1) { if (binding.fileName.text.toString().isEmpty()) {
Toast.makeText(context, R.string.invalid_filename, Toast.LENGTH_SHORT).show() Toast.makeText(context, R.string.invalid_filename, Toast.LENGTH_SHORT).show()
return@setOnClickListener return@setOnClickListener
} }