From d24c061cc64580f7ed8a4210c6c3a5e717f5d2a0 Mon Sep 17 00:00:00 2001 From: Amos Ng Date: Mon, 29 Jun 2020 06:16:28 +0800 Subject: [PATCH] Check for mangadex.org prefix rather than checking if referer contains string --- src/main/kotlin/mdnet/base/server/ImageServer.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/mdnet/base/server/ImageServer.kt b/src/main/kotlin/mdnet/base/server/ImageServer.kt index 13e1c88..dc7c633 100644 --- a/src/main/kotlin/mdnet/base/server/ImageServer.kt +++ b/src/main/kotlin/mdnet/base/server/ImageServer.kt @@ -104,7 +104,7 @@ class ImageServer(private val cache: DiskLruCache, private val statistics: Atomi val referer = request.header("Referer") handled.set(true) - if (referer != null && !referer.contains("mangadex.org")) { + if (referer != null && !referer.startsWith("https://mangadex.org")) { Response(Status.FORBIDDEN) } else if (snapshot != null && imageDatum != null) { request.handleCacheHit(sanitizedUri, getRc4(rc4Bytes), snapshot, imageDatum)