Skip to content

Commit

Permalink
Fixed a bug where bundling a document creates double uri.
Browse files Browse the repository at this point in the history
  • Loading branch information
mush42 committed Jan 18, 2022
1 parent 4ed8653 commit 4df1092
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion bookworm/bookshelf/local_bookshelf/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import contextlib
import urllib.parse
import shutil
import peewee
import requests
import more_itertools
from pathlib import Path
Expand Down Expand Up @@ -266,5 +267,8 @@ def bundle_single_document(database_file, doc_instance):
if not copied_document_path:
return False, document_src, doc_instance.title
doc_instance.uri = doc_instance.uri.create_copy(path=copied_document_path)
doc_instance.save()
try:
doc_instance.save()
except peewee.IntegrityError:
return False, document_src, doc_instance.title
return True, document_src, doc_instance.title

0 comments on commit 4df1092

Please sign in to comment.