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
!331
Fixed weird bug with versatile imgae field
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Fixed weird bug with versatile imgae field
fixed-broken-playlists
into
develop
Overview
0
Commits
1
Pipelines
1
Changes
1
Merged
Agate
requested to merge
fixed-broken-playlists
into
develop
6 years ago
Overview
0
Commits
1
Pipelines
1
Changes
1
Expand
0
0
Merge request reports
Compare
develop
develop (base)
and
latest version
latest version
886680ed
1 commit,
6 years ago
1 file
+
7
−
0
Side-by-side
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
api/funkwhale_api/playlists/serializers.py
+
7
−
0
Options
@@ -107,6 +107,13 @@ class PlaylistSerializer(serializers.ModelSerializer):
@@ -107,6 +107,13 @@ class PlaylistSerializer(serializers.ModelSerializer):
covers
=
[]
covers
=
[]
max_covers
=
5
max_covers
=
5
for
plt
in
plts
:
for
plt
in
plts
:
if
not
hasattr
(
plt
.
track
.
album
.
cover
,
"
crop
"
):
# In some rare situations, we end up with the following stack strace:
# AttributeError: 'VersatileImageFieldFile' object has no attribute 'crop'
# I tend to thing our complex prefetch logic is troubling for versatile
# image field, so wi initialize the missing attribute by hand, cf
# https://github.com/respondcreate/django-versatileimagefield/blob/1.9/versatileimagefield/mixins.py#L108
plt
.
track
.
album
.
cover
.
build_filters_and_sizers
((
0.5
,
0
,
5
),
False
)
url
=
plt
.
track
.
album
.
cover
.
crop
[
"
200x200
"
].
url
url
=
plt
.
track
.
album
.
cover
.
crop
[
"
200x200
"
].
url
if
url
in
covers
:
if
url
in
covers
:
continue
continue
Loading