Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
I've tried to make a block title link to:
reading-room?tid=11
The module translates this into:
reading-room%3Ftid%3D11
Which does not link to the correct page.
Remaining tasks
Comment | File | Size | Author |
---|---|---|---|
#12 | punctuation_in_link-1013700-12.patch | 721 bytes | sumitmadan |
Comments
Comment #1
ngmaloney CreditAttribution: ngmaloney commentedWill work on a patch. Thanks for filing.
Comment #2
ngmaloney CreditAttribution: ngmaloney commentedThis turns out to be an interesting bug (I think). I'm using the l function to generate the URL. That function passes the URL, in this case, reading-room?tid=11, to the url function. The url function escapes query strings and expects them to be passed separately as an options arguments.
The fact that the string escape is happening on the api level makes this a challenge. I'll need to seek some advice on how best to handle this use case. For now, i'll leave this ticket open as I would like to resolve this issue.
Comment #3
ngmaloney CreditAttribution: ngmaloney commented@madmatter23 as a quick work around, specify an absolute URL and it will by pass the string escaping.
Comment #4
grasmash CreditAttribution: grasmash commentedGreat! Thanks for the info. An absolute URL should work fine for now.
Comment #5
neclimdul@ngmaloney Yeah, that's exactly what's happening in l(). I've run into similar problems when having modules link to solr which specifies facets in the query string.
There are 2 options that come to mind for dealing with this.
1) just split the path on ? and use the first part as the path for l(). This would probably fail if there was and fragment though so you'd have to special case that as well.
2) use parse_url() to break up the url and then reform it into arguments to l(). You'll need to add extra logic or just bypass the parse_url() logic for absolute urls though.
Comment #6
ngmaloney CreditAttribution: ngmaloney commentedPostponed. Need maintainer for D6 branch.
Comment #7
Dennis Cohn CreditAttribution: Dennis Cohn commentedsorry wrong forum
Comment #8
ngmaloney CreditAttribution: ngmaloney commentedI'm no longer actively maintaining the Drupal 6 version of the block_titlelink module except for critical and security related bugs. I'll gladly grant contrib access or release an update if anyone wishes to roll a patch.
Comment #9
JKingsnorth CreditAttribution: JKingsnorth commentedCan someone confirm whether this is still a problem in the 6.x-2.0 branch?
Comment #10
rsvelko CreditAttribution: rsvelko commentedI checked now in git and for the 6.x-2.x its not fixed.
It IS fixed in latest git for 7.x - so go in there on line 146 and migrate/backport the changes into 6.x
Comment #11
adammaloneIf someone wants to provide a patch to get this into the Drupal 6 version I'll get that rolled in. It seems like an easy win so I've added the novice tag.
Comment #12
sumitmadan CreditAttribution: sumitmadan commentedCreated a patch, hope it is the correct thing to do.
Comment #13
sumitmadan CreditAttribution: sumitmadan commentedComment #15
sumitmadan CreditAttribution: sumitmadan commentedSorry forgot to change the version. Patch is against the 6.x-2.0.
Comment #17
AnybodyDoes the problem also exists in D7 version? Can we get some more feedback on the patch?
Comment #18
AnybodyConfirming that D7 version does NOT have this issue anymore.
Comment #19
Christie Alcidor CreditAttribution: Christie Alcidor as a volunteer commentedComment #20
Christie Alcidor CreditAttribution: Christie Alcidor as a volunteer commentedComment #21
Christie Alcidor CreditAttribution: Christie Alcidor as a volunteer commentedThis is outdated and is not supported anymore.