File download link doesn't include filename

Open
#1,056 14 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
42/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
python
Domain
api, backend

Research direction

Start at src/plone/restapi/serializer/dxfields.py line 121 and compare the REST API download URL with the linked plone.app.contenttypes template at line 13. Trace the file-download serialization and update the generated link so it includes the filename, then verify that both download access and the caching purge behavior remain covered.

Written by the indexing model from the issue text.

Description

02 type: regression 13 prio: normal 21 status: confirmed

In Plone the download link usually contains the filename at the end.
This has the advantage a user copying the link gets a neat filename on the fs, i.e. when using low level tools like wget.

https://github.com/plone/plone.app.contenttypes/blob/30b6d2c97d3af443cafe6b8b3bcebea470a3f888/plone/app/contenttypes/browser/templates/file.pt#L13

Not so in restapi

https://github.com/plone/plone.restapi/blob/a901075e0ff686db2a75b8d833882b15c6a91ddf/src/plone/restapi/serializer/dxfields.py#L121

I consider this inconsistency a regression.
In practice this has an impact on plone.the purging in app.caching. The URL without the filename at the end wont be purged.

I'll fix this in plone.app.caching to purge all ways to access a file download
https://github.com/plone/plone.app.caching/pull/71

But in the end we loose the feature of good filenames on download if not changed here.

Dominant language
Python
Stars
109
Forks
107
Avg merge
2d 3h
Merged PRs (30d)
4

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from plone/plone.restapi

All issues in plone/plone.restapi

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.