When using fancy URLs (URLs look like /node/1 instead of index.php?q=node/1) fully-qualified links to other articles on the same site are "trimmed" when you submit the article so that they become relative links. However, they are relative to the top of the site, and not relative to the article. This means that if the article at /node/2 contains a link to http://sitename.tld/node/1, the resulting link in the article is "node/1", which when clicked on, results in "/node/node/1" because of the "directory" position in the URL of the current page.

Comments

sepeck’s picture

just tested on recent CVS set up

<a href="node/151">node/151</a>  
<a href="?q=node/151">?q=node/151</a> 
<a href="http://drupal.org">http://drupal.org</a>

Also, filtered HTML didn't seem to porperly filter code tags. Not sure if that was my fault or not yet.

justdave’s picture

I should note that the specific situation I encountered this in is also using URL Aliases (via the path module) for most pages on the site, and the actual URLs of the article that included the link had an alias that had a slash in it (because it was a subsection of a section of the site). The article being linked to was referenced by a traditional node URL though.

sepeck’s picture

I should have said, the first link didn't work, the other two did.

justdave’s picture

Of note... older versions of Drupal seem to have a in the document headers, cvs tip doesn't have that. Seems related....

justdave’s picture

just noticed it ate my tag sample. :) that's a {base href="" /} that I put in (substitute the correct characters for the braces as necessary)

sepeck’s picture

some additional testing.
Blue Marine works fine. In all other core themes it no longer works. chx says it's because of the base_url removal. Drupal.org has lots and lots of links like this. He thinks a small script can update these to use full url's. In any case it needs to be mentioned in update.

Also, the code tags arn't working either. Not sure if that's related or not. (probably not).

chx’s picture

script is small but the execution time... roughly:

$result = db_query("SELECT nid, body FROM {node_revision} WHERE body LIKE '%%href%%'");
while ($node = db_fetch_object($result)) {
  //process the body here...
}
TDobes’s picture

Status: Active » Closed (duplicate)

This is a duplicate of bug 13148.