Needs work
Project:
PDFPreview
Version:
2.0.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
19 Aug 2015 at 12:24 UTC
Updated:
16 Jun 2020 at 23:12 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
mfbComment #3
mfbAnyone have time to take a look at this patch?
Comment #4
helmo commentedI have this patch on prd for a while now ... seems to work great.
Comment #5
edvanleeuwenTested and verified.
Comment #6
rcodinaPatch works for me too. Thanks!
I had problems with PDF previews (403 and 404 errors) when using "Private local files served by Drupal" for file fields configured to store files on private destination. I was using 7.x-2.1. However, to fix the problem, I downloaded latest version using git and then applied file-scheme_1.patch. Then all started working like a charm.
Comment #7
mfbNot sure anyone is maintaining this module these days? We might need a new maintainer to get this committed?
Comment #8
rcodina@mfb Someone should contact the module maintainer and ask for co-maintainer permissions. Last commit is from 18 Feb 2016. There are other important issues solved like #2315257: Generated image links to the image rather than the PDF file.
Comment #9
edvanleeuwenI think this is not enough. The preview image file should be registered as managed file as well.
Or you could set the path to
public://hardcoded, but then you should be careful with files which are supposed to be restricted.Comment #10
mfbI'd agree the preview images should be managed, but that should be a separate feature request.
Comment #11
edvanleeuwenIsn't it related? The problem is that for the private filesystem, there has to be an entry in the file_managed table to give you access to the thumbnail.
Comment #12
mfbMy default file system is set to private, but I want to generate PDF previews for certain file fields that are public. So this patch resolves the issue that PDF Preview module was forcing me to use my default file system for previews.
Comment #13
mstrelan commentedThis will need to be committed to 8.x first. Can someone test this patch against the latest dev snapshot?
Comment #14
mstrelan commentedI'm reluctant to add this without config options. I can see a use case where public thumbnails are generated for private documents, and the user it not required to authenticate until accessing the actual PDF. So I think we should default to matching the source file with the possibility to override with public.
Comment #15
mstrelan commentedConfig options added to attached patch. Needs work because displaying the image from the private file system throws access denied.
Comment #16
mstrelan commentedIf we want to use the private file system then we need to do an access check against the original file, and/or provide a permission to skip access checks. We can use
image_file_download()as an example but due to our filename handling we can't reliably find the source file. One option would be to create a mapping of file id to pdfpreview path, another would be to standardize the preview path similar to image.moduleComment #17
mstrelan commentedThis will be easier once #2346003: Preview image as managed file is in.