zikula / core

Zikula Core Framework
GNU Lesser General Public License v3.0
237 stars 66 forks source link

Exception images not working #2097

Closed craigh closed 9 years ago

craigh commented 9 years ago

The exception images are base64 encoded images like the toolbar but the toolbar images load correctly and the exception images do not.

I've discovered that the toolbar images have html like so: <img width="20" height="28" alt="Forms" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAcAQMAAABbFA0jAAAABlBMVEUAAAA+Pj4LNneDAAAAAXRSTlMAQObYZgAAACxJREFUCNdjYEACjD8gmP8/A8P7/wVw/IChgOH//w9w/AHKf4CLRlILwkgAANMJMNaUFdtJAAAAAElFTkSuQmCC">

and the exception images have html like so: <img alt="" src="http://127.0.0.1/core.git/src/data:image/gif;base64,R0lGODlhHAAWAMQQANra2+bl5s3Mzevr6/Pz8+jo6O3t7fHx8c/Oz+Pj49PS093d3djX2NXV1eDf4MrJyvb29gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAABAALAAAAAAcABYAQAWWICSOEDE4AamqRuAsT5yu6hA/wNrcfNysjl5PBOAJAAUDDRLoNRKDndAHnN6k058qaH2QuNelqCAYIm45MfGmIJCkAvUIPNB1td/uAyvEz/UqB0VUagQOZTEjgzx+Kk1CEAU8DAdqB4gPCHVjNwhucphKbzefamAFdlaNEGBZd1V3r1t6fE6wqrJ5XS4Ovb69MyQnv8QhADs=">

the problem is that the 'broken' one includes the baseUri for some reason (http://127.0.0.1/core.git/src/). this needs to be corrected.

craigh commented 9 years ago

this has something to do with shorturls. if I disable shorturls, then the images work correctly.

cmfcmf commented 9 years ago

I bet this is what does it: outputfilter.shorturls.php

Guite commented 9 years ago

Yes, this is probable.

How about adding something like

$source = str_replace($baseurl . 'data:', 'data:', $source);

here: https://github.com/zikula/core/blob/1.4/src/lib/legacy/viewplugins/outputfilter.shorturls.php#L41 ?

craigh commented 9 years ago

what about just detecting if the string contains data: at the beginning and not applying the filter in the first place?

craigh commented 9 years ago
if (substr($source, 0, 5) == 'data:') {
return;
}

:question: :grey_question:

Guite commented 9 years ago

$source contains the whole output, so this is not possible. One could change the regular expression though, but this would be more difficult and less readable.

cmfcmf commented 9 years ago

Couldn't we add data: to the regexp just like tel:, Skype:, etc?

Guite commented 9 years ago

Maybe...

craigh commented 9 years ago

I can't take a look again until I get home from work in about 9 hours. if you can solve it while I'm gone, then great! :smile:

Guite commented 9 years ago

Please see #2098