The documentation provided in the pathologic.api.php file includes an example for linking to an external CDN. However, the external option does not appear to be referenced or implemented in the pathologic.module file. When using this example code, the resulting URL looks something like http://domain.com/http%3A//cdn.example.com/image.png
Here's the culprit in pathologic.api.php:
// If it's a path to a local image, make sure it's using our CDN server.
if (preg_match('~\.(png|gif|jpe?g)$~', $url_params['path'])) {
$url_params['path'] = 'http://cdn.example.com/' . $url_params['path'];
$url_params['options']['external'] = TRUE;
}
Comments
Comment #2
spleenboy commentedHere's a patch that corrects the issue by testing for the
$url_params['options']['external']boolean and conditionally excludes thebase://prefix from the uri. Apologies if this patch isn't the right format. It's my first official contribution to any Drupal modules!Comment #3
dwwThanks @spleenboy! Looks like this isn't just a bug in the documentation, but that the code itself isn't invoking the hook that the docs describe. Since you uploaded a solution, you could mark this "needs review" in the hopes that someone will notice and move this forward.
Anyway, apologies I didn't look earlier. I forgot I agreed to co-maintain this module, and haven't checked the issue queue in ages. Doing another burst of activity right now and this looks important to solve.
Comment #4
dwwWhoops, sorry. This no longer applies after I committed some other recent fixes. I'm going to try re-working this, and hopefully adding some test coverage, too.
Comment #5
dwwHere's the basic re-roll and a little code cleanup. Still probably wants some dedicated tests to demonstrate the problem and prove the solution.
Comment #6
dwwSorry, got pulled into other things for a bit there. Back at it. Here's trivial test coverage to show the bug. The test-only is the interdiff.
Comment #8
dwwYee haw, those are the test failure results we're expecting:
Comment #11
dwwOh whoops, except the expected should always come first... I'll hotfix that.
Comment #12
dwwAll fixed. Thanks, @spleenboy! And again, very sorry for the multi-year radio silence on your first contribution. I keep forgetting I co-"maintain" this module and almost never look at the issue queue. I'm on a little burst of activity now, and noticed this important fix. Hope you didn't get so discouraged that you didn't try to contribute anything else...