Hi!
I am trying Pathologic to migrate from Path Filter and I am having an issue.
I have a production site published ad http://hostname/sitename and I need to create a test copy and publish it as http://hostname/sitename_new.
All images previously embedded in nodes using IMCE and FCKEditor did not work in the copied site and I read this could be related to the fact that FCKEditor set the images path as /sitename/... and indeed the path of images is still http://hostname/sitename/...

Then I installed and configured Pathlogic and disabled Path Filter. Following the installation guide, I also added /sitename/ in "Also considered local" option. But it does not work. When I checked the images path I found that the filter is generating the following url:

http://hostname/sitename_new/sitename_new/...

instead of

http://hostname/sitename_new/...

So it dows the path substitution but it duplicates the subdirectory...
Am I missing something?

Thanks for all,

CyBerto

Comments

hbar’s picture

I'm having a similar issue on a local site I'm building. Some inline images I inserted using Image Assist are displaying as broken. The rendered html source is displaying a duplicated directory, but in my case, the site's root directory.

The inline image code is like this:

<span class="inline inline-right"><img src="sites/all/files/images/my-image.thumbnail.jpg" alt="" title="" class="image image-_thumbnail " width="100" height="122" /></span>

But the rendered code is like this (note the duplicated directory):

<span class="inline inline-right"><img src="http://localhost:8888/my-site/my-site/sites/all/files/images/my-image.thumbnail.jpg" alt="" title="" class="image image-_thumbnail " width="100" height="122" /></span>

I tried adding a single slash (/) in the "Also considered local" field, but got the same result. I also tried unchecking the "Output full absolute URLs" checkbox, but still got the same result.

My input filters are ordered like this:

  • URL filter (-10)
  • Line break converter (-9)
  • HTML corrector (-8)
  • Hide email addresses using the SpamSpan technique (-7)
  • Inline images (-7)
  • Pathologic (-5)

I just updated Pathologic today, and I think this problem didn't exist before.

  • Drupal 6.17
  • PHP 5.2.11
  • Apache 2.0.63
  • Image Assist 6.x-2.0-alpha4
  • Pathologic 6.x-3.0

Edit: It also happens with handcoded links:

<a href="node/123"</a>

is rendered as:

http://localhost:8888/my-site/my-site/node/123

Thanks. And also thanks for the module. :-)

--

hbar

Garrett Albright’s picture

Status: Active » Needs review
StatusFileSize
new3.24 KB

Dang, where where you people when this was in beta?

I think I found the problem and committed the changes, so please be on the lookout for the newest dev release and give it a try and report back. If it hasn't been packaged yet, you're anxious to get your site back, and you know how to patch, try the attached.

valderama’s picture

seems like i have the same problem with the drupal 7 version of pathologic

[UPDATE]
the problem is that the 'path' part of the url is taken ( $parts['path'] ). If the URL is localhost/drupal7/myimg.gif, then 'drupal7/myimg.gif' is given to the url() function, which results in this wrong URL: localhost/drupal7/drupal7/myimg.gif

[UPDATE2]
just a guess: maybe using drupal_parse_url instead of parse_url helps?

For me that works, but I have no URLs with parameters etc.

function _pathologic_replace($matches) {
  // Build the full URL, then take it apart
  global $base_url;
  if ($matches[9] === '?q=' || $matches[6] === 'index.php') {
    // This will be the case if the link tag was like:
    // <a href="?q=foo">
    $matches[10] = '?q=' . $matches[10];
  }
  $full = $base_url . '/' . $matches[10];
  
  // …then take it apart
  $parts = drupal_parse_url($full);
  // Trim initial slash off path. Note that substr() will return FALSE here if
  // the path is just one character (just '/'), but url() seems to be okay with
  // that.
  return 'src="'.url($parts['path'], $parts).'"';
}
hbar’s picture

Thanks for that. I applied your patch and the problem appears to be fixed! Very pleased by your fast response. First time I applied a patch, surprised how easy it was!).

Sorry I wasn't testing your beta, I only installed Pathologic recently for a new site I'm building (having previously used the Path Filter module). Great work though. Thanks again, Garrett!
--

hbar

Garrett Albright’s picture

Status: Needs review » Fixed

Okay, I've made a new release with these changes. Thanks for testing, hbar.

cyberto’s picture

Hi!

I also agree with hbar: thanks Garrett for the fast reponse. I also tried the patch (first time for me too) and it worked. Now I am updating the module.

Bye

CyBerto

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.