From f791ba56147b4a0cc2e517bd9549d98bdd6d39e5 Mon Sep 17 00:00:00 2001 From: Eliot Berriot Date: Tue, 28 Jan 2020 10:03:50 +0100 Subject: [PATCH] Fix #1015: broken migration on S3 --- api/funkwhale_api/users/migrations/0017_actor_avatar.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/funkwhale_api/users/migrations/0017_actor_avatar.py b/api/funkwhale_api/users/migrations/0017_actor_avatar.py index c97a5fe13..65acb53ad 100644 --- a/api/funkwhale_api/users/migrations/0017_actor_avatar.py +++ b/api/funkwhale_api/users/migrations/0017_actor_avatar.py @@ -19,13 +19,13 @@ def create_attachments(apps, schema_editor): print('Creating attachments for {} user avatars, this may take a while…'.format(total)) from django.core.files.storage import FileSystemStorage for i, user in enumerate(qs): + size = None if isinstance(user.avatar.storage._wrapped, FileSystemStorage): try: size = user.avatar.size except FileNotFoundError: # can occur when file isn't found on disk or S3 print(" Warning: avatar file wasn't found in storage: {}".format(e.__class__)) - size = None obj_attachment_mapping[user.actor] = Attachment( file=user.avatar, size=size,