After updating the image module to version 5.x-1.6, I can no longer view non-image files uploaded to nodes via the upload module.
To view attached .pdf files for example, I need to add the "view original images" right to anonymous users, or I'll get an access denied page.
| Comment | File | Size | Author |
|---|---|---|---|
| #15 | image_187054_2.patch | 1.67 KB | roderik |
| #11 | image_187054.patch | 1.23 KB | drewish |
| #10 | image_187054.patch | 1.22 KB | drewish |
| #3 | image-5.x-1.6-patch-for-187054.patch | 807 bytes | jandd |
Comments
Comment #1
jandd commentedI have the same problem on several PostgreSQL based sites. There's a warning message:
The line is in function image_file_download($filename):
if (user_access('view original images') || in_array($filepath, $images))$images doesn't seem to be an array.
Comment #2
jandd commentedThe problem was introduced in the latest patch for http://drupal.org/node/170659
Comment #3
jandd commentedThe attached patch fixes the problem. I don't know if $node->images is set at all in the function maybe someone with more knowledge of the image module should look at the function again.
Comment #4
drewish commentedoh, maybe we should be checking node type...
Comment #5
radj commentedIs there no final fix for this issue? Anonymous users still cannot view the thumbnail and preview. :(
Comment #6
drewish commentedradj, rather thank complaining about a final fix please review the posted patch.
Comment #7
starbow commentedI used the code in this patch and it fixed the problem for me.
Comment #8
nterbogt commented+1 for me too. The patch above works as expected and quick visual review didn't raise any issues.
Comment #9
roderik+1 again. Patch still applies cleanly to 1.x-dev, and works.
@drewish - #4: does checking node type work? I got the error while trying to download a non-image attachment, for a node whose type does support uploading images, but which has no images attached.
(I don't know enough Drupal/PHP 'coding standard' to set the patch to 'ready to be committed'... I don't know if $node->images should return an empty array in that case?)
Comment #10
drewish commentedgive this a try...
Comment #11
drewish commentedwhoops, ignore that last one... wrong variable name.
Comment #12
roderikPatch works - and code reads like it's a better solution, yes.
Comment #13
drewish commentedgreat, committed to HEAD.
Comment #14
(not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #15
roderik*weeps*
The patch you rolled does not actually solve the problem - unlike jandd's patch which does.
And apparently I didn't test correctly. Sorry :-/
That is: if the node has no image attached, '-1' is still returned. No good.
This contains a patch to the latest (19 dec) 1.x-dev.
I'm still a PHP / Drupal Coding nitwit, so please check the first line I added ('if ($node) {') for sanity. Thanks.
Comment #16
drewish commentedLooks good to me. Committed to DRUPAL-5 and DRUPAL-5--2.
Comment #17
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.