Skip to content

Commit

Permalink
Parse upload URL into path before resolving
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanw committed Sep 26, 2024
1 parent 7bf5646 commit 41eedf7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion froide/upload/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import os
import tempfile
import uuid
from urllib.parse import urlparse

from django.contrib.auth import get_user_model
from django.core.exceptions import ValidationError
Expand Down Expand Up @@ -167,8 +168,10 @@ def finish(self):

class UploadManager(models.Manager):
def get_by_url(self, upload_url, user=None, token=None):
parsed_upload_url = urlparse(upload_url)
upload_path = parsed_upload_url.path
try:
match = resolve(upload_url)
match = resolve(upload_path)
except Resolver404:
return None
guid = match.kwargs.get("guid")
Expand Down

0 comments on commit 41eedf7

Please sign in to comment.