mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-07-04 03:14:40 -05:00
Check if file exists (#1246)
This commit is contained in:
@@ -11,6 +11,7 @@ import kotlin.concurrent.thread
|
|||||||
import kotlin.io.path.ExperimentalPathApi
|
import kotlin.io.path.ExperimentalPathApi
|
||||||
import kotlin.io.path.deleteIfExists
|
import kotlin.io.path.deleteIfExists
|
||||||
import kotlin.io.path.deleteRecursively
|
import kotlin.io.path.deleteRecursively
|
||||||
|
import kotlin.io.path.exists
|
||||||
import kotlin.io.path.name
|
import kotlin.io.path.name
|
||||||
import kotlin.io.path.outputStream
|
import kotlin.io.path.outputStream
|
||||||
import kotlin.time.Duration.Companion.days
|
import kotlin.time.Duration.Companion.days
|
||||||
@@ -46,7 +47,7 @@ object TemporaryFileStorage {
|
|||||||
|
|
||||||
fun retrieveFile(name: String): Path {
|
fun retrieveFile(name: String): Path {
|
||||||
val file = folder.resolve(name).normalize()
|
val file = folder.resolve(name).normalize()
|
||||||
check(file.startsWith(folder)) {
|
check(file.startsWith(folder) && file.exists()) {
|
||||||
"File $name is not in ${folder.name}"
|
"File $name is not in ${folder.name}"
|
||||||
}
|
}
|
||||||
return file
|
return file
|
||||||
|
|||||||
Reference in New Issue
Block a user