1
0
Fork 1
mirror of https://gitlab.com/mangadex-pub/mangadex_at_home.git synced 2024-01-19 02:48:37 +00:00

Properly close snapshot if referer invalid

This commit is contained in:
Amos Ng 2020-06-29 06:42:44 +08:00
parent d24c061cc6
commit 620a859d5c
No known key found for this signature in database
GPG key ID: 89086414F634D123

View file

@ -105,6 +105,10 @@ class ImageServer(private val cache: DiskLruCache, private val statistics: Atomi
handled.set(true) handled.set(true)
if (referer != null && !referer.startsWith("https://mangadex.org")) { if (referer != null && !referer.startsWith("https://mangadex.org")) {
if (snapshot != null) {
snapshot.close()
}
Response(Status.FORBIDDEN) Response(Status.FORBIDDEN)
} else if (snapshot != null && imageDatum != null) { } else if (snapshot != null && imageDatum != null) {
request.handleCacheHit(sanitizedUri, getRc4(rc4Bytes), snapshot, imageDatum) request.handleCacheHit(sanitizedUri, getRc4(rc4Bytes), snapshot, imageDatum)