Fine:

  • You want to make a link to another page
  • Your link looks like "node/123" where 123 is the node ID of the page you want to link to
  • Pathologic translates the "node/123" URL into the "nice" one that you get with PathAuto (like "content/page-title") and that's great

Bad:

  • You want to make a link to another page
  • You write the link as "node/123/", with a trailing slash, for whatever reason (typo, etc)
  • The link is still valid for Drupal, but Pathologic doesn't translate the URL into the "nice" one and your get a cryptic link in the middle of nice ones

As I'm working on a website which has several (non-technical) editors, the error happens from time to time. Can Pathologic parse node URLs with a trailing slash as well?

Thanks.

Comments

Garrett Albright’s picture

Not efficiently. Sorry.

It looks like what might serve you better is a filter ordered before Pathologic which removes slashes at the end of relative paths. That would probably be something you'd have to hammer together yourself and/or get someone to hammer together for you.

mdupont’s picture

So this is "won't fix"? I'll try to use flexifilter to handle this.

Garrett Albright’s picture

Status: Active » Closed (won't fix)

Yes. Sorry.

John Hodgins’s picture

Version: 6.x-1.1-beta13 » 6.x-2.0-beta23
Category: bug » feature
Status: Closed (won't fix) » Needs review

Hi, I have the same need on my site, and Pathologic seems the ideal place to do it. I've added the following line at line 180 of the beta-23 version and it seems to work perfectly for me:

$path = rtrim($path, '/');

Am I missing some obvious problem?

Great module by the way -- very useful!

Garrett Albright’s picture

Status: Needs review » Closed (won't fix)

Sorry. I know it's a simple "fix," but it's still out of Pathologic's scope. Please either use some other filter to trim off trailing slashes (mdupont suggested Flexifilter above) or train users not to end paths with slashes.

mdupont’s picture

Update: Global Redirect may be the module you need, as it removes trailing slashes and ensures that node/123 paths will always be redirected to aliased paths. Be aware though that there might be issues with multilingual websites (redirecting to the wrong language if the alias is the same). Pathologic + Path Redirect + Global Redirect has been the winning combination for me.

Garrett Albright’s picture

Thanks for the update, mdupont. Could you elaborate a little by telling us what order you have those filters in?