Closed (fixed)
Project:
CDN
Version:
6.x-2.x-dev
Component:
Module
Priority:
Major
Category:
Bug report
Assigned:
Reporter:
Created:
8 Jun 2012 at 17:29 UTC
Updated:
28 Feb 2013 at 19:06 UTC
Jump to comment: Most recent file
When an image is linked to its node (rather than the original image or some imagecache preset), the link to the node is improperly rewritten to use the CDN. This was introduced in http://drupalcode.org/project/cdn.git/commit/6dde0e1 which was a fix for issue 1165404.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | cdn-fix_link_rewriting-1623252-5.patch | 2.34 KB | wim leers |
| #4 | cdn-fix_link_rewriting-1623252-4.patch | 2.33 KB | wim leers |
| #2 | cdn-fix_link_rewriting-1623252-2.patch | 2.18 KB | pdrake |
| #1 | cdn-fix_link_rewriting-1623252-1.patch | 2 KB | pdrake |
Comments
Comment #1
pdrake commentedThis patch adds an option that checks to ensure the link file name matches the image file name before rewriting it to use CDN.
Comment #2
pdrake commentedThis patch is the same as above but adds a missing @param comment.
Comment #3
elliotttf commentedThe patch in #2 is working perfectly for me.
Comment #4
wim leersThank you very much!
I tested it, and unfortunately it breaks another scenario, e.g. the one on wimleers.com. It looks like this:
<a href="//cdn/files/image.png"><img src="//cdn/files/resize/image-420x69.png"></a>I.e., the filenames do not perfectly match (because the thumbnail image is resized using the Image Resize Filter), but it's *still a file*.
Proposed solution: compare the file extensions instead of the file paths.
I also just merged #1557948: When using wildcard CDN mapping: image links always point to the CDN, even when not linking to an image but to an HTML page with this one.
Comment #5
wim leersAnd here's a patch that does just that. Also fixed a critical bug in it: the return statement should've been a continue statement…
Comment #6
elliotttf commentedThis also works for me and looks good. +1
Comment #7
wim leersI'd like @pdrake's approval as well :)
Comment #8
damienmckenna+1, patch #5 works for me too. Also: grrrr.
Comment #9
damienmckennaBumping this to Major as it, to all intents and purposes, breaks your site.
Comment #10
pdrake commented#5 works for me - I would mark this RTBC if it wasn't already.
Comment #11
pdrake commentedApparently, DamienMcKenna and I were updating at the same time - putting this back to Major as I agree with that priority.
Comment #12
damienmckennaFYI, here are the settings I was using that triggered the problem on our site:
Comment #13
wim leersThanks, will commit very soon, backport and do new releases.
Comment #14
wim leersCommitted + backported.
http://drupalcode.org/project/cdn.git/commit/1633a67
http://drupalcode.org/project/cdn.git/commit/7bb8163
Comment #15
mrsimonelliott commenteddev version fixed this for me, thanks
Comment #16
mile23This is a problem for 7.x-2.5, as well.
Images set to link to content end up sending the browser to cloudfront.
Comment #17
damienmckenna@Mile23: This has been fixed and is available via the -dev downloads, otherwise just wait for the next release.
Comment #19
wim leersThis now has test coverage thanks to #1929918: Test coverage for image URL rewriting.
Comment #20
dan.mantyla commentedYup, just discovered my sites are now directing users to 234fs452fd5.cloudfront.net/my/site and users are like "am I getting phished??"
Thanks for fixing this!!
I'm using 7.x-2.5, this has been patched in 7.x-2.x-dev as well as 6?
I would suggest that [6|7].x-2.6 be released ASAP, as it is a major bug, but now with the latest security release to Drupal core, 7.20, the CDN module has much more work ahead of it... Great module though! I hope to contribute soon.
Comment #21
wim leersCorrect.
Working on that: #1915662: [meta] 2.6 release (bugfixes only). :)
Great! :)