Closed (fixed)
Project:
Links Package
Version:
master
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Reporter:
Created:
1 Jan 2006 at 01:29 UTC
Updated:
4 Feb 2006 at 20:01 UTC
Jump to comment: Most recent file
I just downloaded a fresh HEAD and a fresh copy of the links module, enabled the links, links_related, and links_weblink modules, and added a weblink node.
When I try and click "Visit [sitename]" the URL becomes: ?q=?q=links/goto/1/1 and thus gives me a "Page not found" error. This makes this module unusable without Clean URLs. :(
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | links.inc.patch | 792 bytes | webchick |
Comments
Comment #1
webchickLooks like the double-escape happens in links_get_list:
Line 878:
$url = links_format_goto_url($node->nid, $link['lid']);
(links_format_goto_url returns url('links/goto/'.$nid.'/'.$lid))
Line 906:
$list[] = links_l($linktext, $url, $attr);
links_l returns l($text, $url, $attribs);
So the link is first being sent through url() and then through l(), resulting in ?q=?q=....
Comment #2
webchickOk, here is "a" patch to solve this problem, which is cheesy and just removes the url() calls in links_format_goto_url. I assume those are there for a reason, however, so I have my doubts that this is the desired solution.
Comment #3
Bèr Kessels commented/**
* Make a Drupal-standard URL that points to the proper
* "goto" page in this module. The returned URL has already
* been processed through Drupal's url() function.
*/
So, in other words, if a module passes a link that already is url()ed, the bug is in that module. A patch for the offending module would be much nicer, IMO.
Comment #4
webchickSorry, Bèr, I didn't quite understand. There is no other offending module here, this all happens from within links.inc.
If we expect links_format_goto_url to return url()ed content, then we should not l() that content down in links_l() when the list is created, because then it wraps the thing in ?q= again. Or, we should not url() the links before they're passed to links_l() (this is the solution I proposed).
Or, do you mean that Drupal's l() and url() functions should be smart enough to know if a link is already in the ?q= format and not prepend ?q= again if that's the case?
Comment #5
Steve Dondley commentedwebchick, replace "module" with "function" and you'll see what he means. The problem is the call to the function, not the function itself.
Comment #6
syscrusher commentedOops...looks like I goofed. I'm at work right now, but will take a look at this problem this evening and hopefully get a CVS change committed after I have time to review your comments more carefully. For now, I just wanted to let you know I've seen the bug report. Thanks for finding this!
Scott
Comment #7
syscrusher commentedThis is fixed in today's CVS commit. The problem was a design flaw in the semantics of links_format_goto_url(), which has now been redefined to return the Drupal URL rather than the physical URL. (In other words, "working as designed -- designed wrong!")
Thanks for a very helpful bug report and discussion.
Syscrusher
Comment #8
(not verified) commented