Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
funkwhale
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
funkwhale
funkwhale
Merge requests
!1007
Fix
#1015
: broken migration on S3
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Fix
#1015
: broken migration on S3
1015-fix-migration-error
into
develop
Overview
0
Commits
1
Pipelines
1
Changes
1
Merged
Agate
requested to merge
1015-fix-migration-error
into
develop
5 years ago
Overview
0
Commits
1
Pipelines
1
Changes
1
Expand
Closes
#1015 (closed)
0
0
Merge request reports
Compare
develop
develop (base)
and
latest version
latest version
f791ba56
1 commit,
5 years ago
1 file
+
1
−
1
Side-by-side
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
api/funkwhale_api/users/migrations/0017_actor_avatar.py
+
1
−
1
Options
@@ -19,13 +19,13 @@ def create_attachments(apps, schema_editor):
@@ -19,13 +19,13 @@ def create_attachments(apps, schema_editor):
print
(
'
Creating attachments for {} user avatars, this may take a while…
'
.
format
(
total
))
print
(
'
Creating attachments for {} user avatars, this may take a while…
'
.
format
(
total
))
from
django.core.files.storage
import
FileSystemStorage
from
django.core.files.storage
import
FileSystemStorage
for
i
,
user
in
enumerate
(
qs
):
for
i
,
user
in
enumerate
(
qs
):
size
=
None
if
isinstance
(
user
.
avatar
.
storage
.
_wrapped
,
FileSystemStorage
):
if
isinstance
(
user
.
avatar
.
storage
.
_wrapped
,
FileSystemStorage
):
try
:
try
:
size
=
user
.
avatar
.
size
size
=
user
.
avatar
.
size
except
FileNotFoundError
:
except
FileNotFoundError
:
# can occur when file isn't found on disk or S3
# can occur when file isn't found on disk or S3
print
(
"
Warning: avatar file wasn
'
t found in storage: {}
"
.
format
(
e
.
__class__
))
print
(
"
Warning: avatar file wasn
'
t found in storage: {}
"
.
format
(
e
.
__class__
))
size
=
None
obj_attachment_mapping
[
user
.
actor
]
=
Attachment
(
obj_attachment_mapping
[
user
.
actor
]
=
Attachment
(
file
=
user
.
avatar
,
file
=
user
.
avatar
,
size
=
size
,
size
=
size
,
Loading