diff --git a/server.py b/server.py
index 6f5d472928f3bb92de31945bf13a21ff07026a9e..e8ddd0efd36fe71f5a548241f13a43ba183d124d 100644
--- a/server.py
+++ b/server.py
@@ -431,7 +431,8 @@ def auth(): #pylint: disable=too-many-branches
 		cookie = int(request.cookies['tracking'])
 	else:
 		cookie = random.getrandbits(8*8-1)
-	if url.endswith('jpg') or ismod():
+	url_path = urllib.parse.urlparse(url).path
+	if url_path.endswith('jpg') or ismod():
 		return "OK", 200
 	if url.startswith('pub/hls/'):
 		handle = url[len('pub/hls/'):].split('_')[0].split('.')[0]