Download & Extend

Link Paths in Summary / Teaser on Sent Email Broken

Project:Forward
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:closed (works as designed)

Issue Summary

When a user forwards a page to a friend, the module automatically sends a Summary / Teaser of the page. Unfortunately, if the links on the original page do not include the full url (including the domain, ie http://www.domain.com/page/ ), the links in the forwarded email show up as relative to the user's machine (ie, file:///C:/page). Any images in the Summary or urls are broken.

This is a terrible user experience and the module currently does not offer a way to turn off the Summary. The link to the page generated by the module works correctly.

Comments

#1

Status:active» closed (cannot reproduce)

Have you customized the template? I am unable to reproduce this with the current dev version. Give that a try and let me know if that works for you, or you can grab the 6.x-1.17 version when I release it later today.

#2

Sorry for the long reply...been head down on other issues. I don't know, but I'll try it out. I hope it works, it was quite annoying. :)

The content was in blocks on the home page. They were hardcoded urls that were root relative. In our case, we changed the default files path to /media/subdir rather than /sites/site.com/files (did I mention this is a multisite? ). I could have included the full file path using drupal variables, but that would require php execution in a block....which is a security risk.

If I'm doing something wrong or if there is a workaround, I would love to know it.

#3

Version:6.x-1.16» 6.x-1.x-dev
Status:closed (cannot reproduce)» active

Reproduced with both 6.x-1.19 and dev versions.

- Fresh install of Forward
- No template changes
- Uploaded and inserted image into content text via WYSIWYG editor
- Image URL is of the form: /sites/all/files/images/image.png
- Forwarded email contains image with above URL without adding the hostname.

#4

A workaround is to externally add the full hostname to relative URLs. The following function goes in your theme's template.php:

<?php
function phptemplate_preprocess_forward(&$variables) {
 
$options['absolute'] = 'True';
 
$variables['teaser'] = str_replace('src="/', 'src="' . check_url(url('',$options)) , $variables['teaser'] );
}
?>

This works when forwarding the teaser, it can be modified to apply to the full node as well if required. It works for my situation and doesn't include relative URLs which don't start with /.

Something similar could probably be done within the module.

#5

@imclean That is an awesome suggestion. We will have to try it out!

BTW, we are not using a standard /files path. Not sure if that caused the problem or not, unfortunately this isn't a high priority ATM. I'll eventually get back to it :)

UPDATE:
I did try @imclean suggestion. Didn't work. The problem is bigger than just the image paths...the CSS doesn't display which means the teaser doesn't display properly due to the way the page is set up. So we would need a way to include the CSS into the email. I don't think there's a way to really do that with the teaser. Haven't checked yet for the page.

#6

Status:active» closed (works as designed)

The Pathologic module addresses this issue:

http://drupal.org/project/pathologic

Also see this thread:

http://drupal.org/node/1481298