Skip to content

Commit 82acc8f

Browse files
committed
fix: download files due to filename length
1 parent 4ca88e7 commit 82acc8f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

app/src/main/java/com/github/libretube/ui/dialogs/DownloadDialog.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ class DownloadDialog : DialogFragment() {
149149
return@onDownloadConfirm
150150
}
151151

152-
if (fileName.length > MAX_FILE_NAME_LENGTH - 20) { // reserve 20 chars for quality and extension
152+
if (fileName.toByteArray().size > MAX_FILE_NAME_BYTES - 32) { // reserve 32 bytes for quality and extension
153153
Toast.makeText(context, R.string.filename_too_long, Toast.LENGTH_SHORT).show()
154154
return@onDownloadConfirm
155155
}
@@ -265,7 +265,7 @@ class DownloadDialog : DialogFragment() {
265265
/**
266266
* Max file name length at Android systems
267267
*/
268-
private const val MAX_FILE_NAME_LENGTH = 255
268+
private const val MAX_FILE_NAME_BYTES = 255
269269

270270
private const val VIDEO_DOWNLOAD_QUALITY = "video_download_quality"
271271
private const val VIDEO_DOWNLOAD_FORMAT = "video_download_format"

0 commit comments

Comments
 (0)