mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-04 10:29:20 +02:00
Fixed broken attachment fetching with long filename
This commit is contained in:
parent
f0b72c8204
commit
7d528ba235
2 changed files with 25 additions and 3 deletions
|
@ -80,9 +80,10 @@ def fetch_remote_attachment(attachment, filename=None, save=True):
|
|||
for chunk in r.iter_content():
|
||||
tf.write(chunk)
|
||||
tf.seek(0)
|
||||
attachment.file.save(
|
||||
filename or attachment.url.split("/")[-1], File(tf), save=save
|
||||
)
|
||||
if not filename:
|
||||
filename = attachment.url.split("/")[-1]
|
||||
filename = filename[-50:]
|
||||
attachment.file.save(filename, File(tf), save=save)
|
||||
|
||||
|
||||
@celery.app.task(name="common.prune_unattached_attachments")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue