Skip to content

Commit

Permalink
FileLinkForm: fix duplicate check
Browse files Browse the repository at this point in the history
  • Loading branch information
BartSchuurmans committed Mar 9, 2024
1 parent 9e7b040 commit be29b93
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions bookwyrm/forms/links.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" using django model forms """

from urllib.parse import urlparse

from django.utils.translation import gettext_lazy as _
Expand Down Expand Up @@ -36,12 +37,9 @@ def clean(self):
"This domain is blocked. Please contact your administrator if you think this is an error."
),
)
if (
not self.instance
and models.FileLink.objects.filter(
url=url, book=book, filetype=filetype
).exists()
):
if models.FileLink.objects.filter(
url=url, book=book, filetype=filetype
).exists():
# pylint: disable=line-too-long
self.add_error(
"url",
Expand Down

0 comments on commit be29b93

Please sign in to comment.