Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jovuit
funkwhale
Commits
d4160f86
Commit
d4160f86
authored
Nov 19, 2020
by
Robert Kaye
Committed by
Agate
Nov 19, 2020
Browse files
Skip importing files that cause index violations
parent
fdf76fb1
Changes
1
Hide whitespace changes
Inline
Side-by-side
api/funkwhale_api/music/management/commands/import_files.py
View file @
d4160f86
...
...
@@ -17,6 +17,7 @@ from django.core.files import File
from
django.core.management
import
call_command
from
django.core.management.base
import
BaseCommand
,
CommandError
from
django.db.models
import
Q
from
django.db.utils
import
IntegrityError
from
django.utils
import
timezone
from
rest_framework
import
serializers
...
...
@@ -832,6 +833,13 @@ def check_upload(stdout, upload):
except
serializers
.
ValidationError
as
e
:
stdout
.
write
(
" Invalid metadata: {}"
.
format
(
e
))
return
except
IntegrityError
:
stdout
.
write
(
" Duplicate key violation for metadata. Skipping...
\n
{}"
.
format
(
upload
.
source
)
)
return
else
:
upload
.
checksum
=
checksum
upload
.
save
(
update_fields
=
[
"checksum"
])
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment