fix cache dir issue when used in command templates

This commit is contained in:
deniscerri 2025-11-02 09:25:29 +01:00
parent 39119738ef
commit 9240242240
No known key found for this signature in database
GPG key ID: 95C43D517D830350

View file

@ -1442,7 +1442,7 @@ class YTDLPUtil(private val context: Context, private val commandTemplateDao: Co
if (downloadItem.extraCommands.isNotBlank() && downloadItem.type != DownloadViewModel.Type.command){
// check for cache dir as extra command and add it as an actual option to prevent --no-cache-dir in youtubedl_android
val cacheDirArg = """(--cache-dir (".*"))""".toRegex().find(downloadItem.extraCommands)
val cacheDirArg = """--cache-dir\s+"([^"]+)"""".toRegex().find(downloadItem.extraCommands)
if (cacheDirArg != null) {
ytDlRequest.addOption("--cache-dir", cacheDirArg.groupValues.last().replace("\"", ""))
runCatching {