#651 send a webpage user's html: local url's not made absolute

open
Justin J
mailing (71)
5
2009-12-20
2009-12-20
Diab Jerius
No

If I supply my own HTML content using "Send a Webpage" and have "have their URLs changed to absolute" checked, relative URL's are not being transformed into absolute ones. For example, I'm using FCKeditor and am embedding images which I've uploaded using it. The resultant image tags have a src attribute of "/userfiles/image/myimage.jpg" which isn't being transformed into "http://my.server/userfiles/image/myimage.jpg". I've tracked this down to the call to MyMIMELiteHTML::parse in DADA::App::MassSend.pm (in Dada Pro 4.0.1):

654 if($q->param('content_from') eq 'url'){
655 $MIMELiteObj = $mailHTML->parse($q->param('url'), $t);
656 }else{
657 $MIMELiteObj = $mailHTML->parse($q->param('html_message_body'), $t);
658 }

The parse call should be passed the server's URL as a third parameter:

657 $MIMELiteObj = $mailHTML->parse($q->param('html_message_body'), $t, 'http://my.server/');

And relative URL's are correctly transformed. Obviously that last parameter should be some configuratiion variable containing the server's URL, but I'm not sure which one it should be.

Thanks,
Diab

Discussion

  • Diab Jerius
    Diab Jerius
    2009-12-20

    It looks like a similar fix might be appropriate in DADA/MailingList/Schedules.pm:

    936 if($record->{'HTML_ver'}->{source} eq 'from_url'){
    937 $MIMELiteObj = $mailHTML->parse($HTML_ver, $plaintext_alt, $record->{'HTML_ver'}->{url});
    938 }
    939 else {
    940 $MIMELiteObj = $mailHTML->parse($HTML_ver, $plaintext_alt);
    941 }

     
  • Justin J
    Justin J
    2009-12-20

    You can actually get around this by simply using a full URL in FCKeditor's file browser, in the config.php file:

    $Config['UserFilesPath'] = 'http://example.com/userfiles/' ;

    instead of just,

    $Config['UserFilesPath'] = '/userfiles/' ;

    There's really no support (yet) for what you're saying should be used.