Small add'on to improve pdf & file view/downloads, can't remember name

I recently stumbled upon a small Plone add'on which improves the file view/download template in Plone. mainly to fix pdf's showing inline instead of always being offered as a download. But I cannot find it again. It had a non obvious package name, it's not rer.downloadurl, but something else.

Been searching for 45 minuts, on this forum as well, but cannot find it again. Let's try some community memory, anyone?

I remember it was discussed here, and I think @smcmahon created it?

Edit: this one? https://github.com/smcmahon/collective.download_fixes

Thanks, yes that’s the one!

I vaguely remember it being from Steve, but I also couldn’t find it on PyPi’s author list either.

That is one of various projects that I did over the years but never got around to transferring to the collective and uploading to PyPI. If anyone's interested in doing that with this one, feel free!

Oh, this would be very useful!
I'm not familiar with the process to transfer to the collective and upload to PyPI
Can it be used as is from github?
thx very much!

Can it be used as is from github?

Sure.

https://github.com/collective/collective.documentviewer ?

Hi @all,

Is there anything new on this topic?
I noticed that there should actually be a fix for PDFs:
/backend/lib/python3.9/site-packages/plone/namedfile/browser.py

ALLOWED_INLINE_MIMETYPES = [

...
"application/pdf",
...

But all PDF files that I link are first opened in FileView and then with the URL extension /@@download

Regardless of whether you want the file to be opened directly in the browser, I actually find the intermediate step via the FileView view unnecessary.

When I want to look at the information about this file with curl -I http://localhost:3000/publication/2303-03126.pdf I don't see the file itself:

Content-Type: text/html; charset=utf-8

And even in the backend, only after a whole series of clicks do I get to a URL that provides me with information about content disposition: curl -I http://localhost:8080/Plone/publication/paper/2303-03126.pdf/view /++widget++form.widgets.file/@@download/2303.03126.pdf

Content-Disposition: attachment; filename*=UTF-8''2303.03126.pdf
Content-Length: 3976285
Content-Type: application/pdf

I'm surprised not to find any new posts on this topic.
I use the latest versions of Plone (6.0.6) and Volto 16.22.0

Actually, I would guess that downloading or viewing PDFs should be a basic feature that almost everyone uses

Are you asking for something specific?

Possibly useful: I had asked in Discord #general:

is there a URL that can allow me to view a PDF in the browser, rather than download it? https://demo.plone.org/documents/r05a11655_pub.pdf/

and @petschki replied:

There's the @@display-file view: https://demo.plone.org/documents/r05a11655_pub.pdf/@@display-file/file

so viewing PDFs can be accomplished via the browser's capabilities directly.

Maybe I've overlooked something important. My actual goal is to save a PDF file, for example under docs, and place a link to this PDF anywhere.

Mouseover on the link then shows:
https://demo.plone.org/documents/samba-howto-collection.pdf
What happens to me is that when you click on the link, the file item page of the PDF opens.

There is a link to the PDF again. The mouseover then shows the link https://demo.plone.org/documents/samba-howto-collection.pdf/@@download/file

Depending on the browser, the download is then started and either offered for saving or opened in the browser.

My idea was to change this to @@display-file, hence the question above.

At the moment it doesn't really matter to me whether only the download is offered.

But how can I create a link to the PDF without the intermediate step via the File Item?

For some cases, I needed to change the view

Related: Direct download of pdf-files (as Link), can not remember 'name'

@espenmn

Thank you for the tip, sometimes you can't see the forest for the trees. (If the meaning of this literal translation has not been lost)

I've already created content type views myself, but somehow I never came up with the idea of changing the view for the type file

I actually thought I understood how it works by now, but unfortunately it still doesn't work like I thought.

What I have found out is that there is a difference between the state when you are logged in and when you are not logged in. I wasn't aware of that before.
Specifically, I have now even been able to see this on https://demo.plone.org without changing anything in the view.
I uploaded a PDF and then created a link to it. As long as I'm logged in, when I click on the link, the file object is displayed first. If I log out, the URL of the link is expanded by /@@download/file and I can download the PDF...

So far so good and understandable, but the approach of changing the content type file or its view in the ZMI, or as I thought changing the alias of the view of the content type file to @@display-file doesn't work.

I suspect that Volto may not even take these changes from the backend into account, which again brings up the question of how can I change @@download to @@display-file in Volto?

Do I perhaps need to change the UniversalLink:
node_modules/@plone/volto/src/components/manage/UniversalLink/UniversalLink.jsx
There the URL is checked for internal or external and external links then get the extension @@display-file
The question now would be whether it is worth the effort to also include the check for config.settings.viewableInBrowserObjects for internal links?