mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-10 12:47:26 +01:00
Don't validate the page number and extension when saving a page
This commit is contained in:
parent
ea790faeb3
commit
bb89b72a81
@ -578,8 +578,9 @@ class ReaderPresenter : BasePresenter<ReaderActivity>() {
|
|||||||
|
|
||||||
// Build destination file.
|
// Build destination file.
|
||||||
val ext = MimeTypeMap.getSingleton().getExtensionFromMimeType(mime) ?: "jpg"
|
val ext = MimeTypeMap.getSingleton().getExtensionFromMimeType(mime) ?: "jpg"
|
||||||
val filename = "${manga.title} - ${chapter.name} - ${page.index + 1}"
|
val filename = DiskUtil.buildValidFilename(
|
||||||
val destFile = File(destDir, DiskUtil.buildValidFilename(filename) + ".$ext")
|
"${manga.title} - ${chapter.name}") + " - ${page.index + 1}.$ext"
|
||||||
|
val destFile = File(destDir, filename)
|
||||||
|
|
||||||
context.contentResolver.openInputStream(page.uri).use { input ->
|
context.contentResolver.openInputStream(page.uri).use { input ->
|
||||||
destFile.outputStream().use { output ->
|
destFile.outputStream().use { output ->
|
||||||
|
@ -50,8 +50,8 @@ object DiskUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Even though vfat allows 255 UCS-2 chars, we might eventually write to
|
// Even though vfat allows 255 UCS-2 chars, we might eventually write to
|
||||||
// ext4 through a FUSE layer, so use that limit minus 5 reserved characters.
|
// ext4 through a FUSE layer, so use that limit minus 15 reserved characters.
|
||||||
return sb.toString().take(250)
|
return sb.toString().take(240)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user