Commit d4160f86 authored by Robert Kaye's avatar Robert Kaye Committed by Agate
Browse files

Skip importing files that cause index violations

parent fdf76fb1
......@@ -17,6 +17,7 @@ from django.core.files import File
from import call_command
from 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))
except IntegrityError:
" Duplicate key violation for metadata. Skipping...\n{}".format(
upload.checksum = checksum["checksum"])
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment