It seems that pathologic encodes HTML entities found in local paths.
http://not-local-site.com/questionmark?apersand&pipe|lbracket]rbracket[colon:
renders correctly as
http://not-local-site.com/questionmark?apersand&pipe|lbracket]rbracket[colon:
However, domains specified in pathologic's filter settings get rewritten (and break)
http://local-site.com/questionmark?apersand&pipe|lbracket]rbracket[colon:
renders as
http://local-site.com/questionmark?apersand&%3Bpipe%7Clbracket%5Drbracket_colon%3A
Glancing at the code, I thought perhaps pathauto settings might have an impact on punctuation. I set ampersands to not be replaced, but the result is the same.
This is the URL I'm hoping to render out on my site: <a href="/civicrm/contribute/transact?reset=1&id=1">CiviCRM DONATE PAGE</a>
Comment | File | Size | Author |
---|---|---|---|
#2 | pathologic-wysiwyg-links-1303782-2.patch | 583 bytes | dealancer |
Comments
Comment #1
dealancer CreditAttribution: dealancer commentedFollow!
This happens also for 6 version. The problem occurs when FCK editor module (or any WYSIWYG) is enabled.
So what happens:
Comment #2
dealancer CreditAttribution: dealancer commentedHere is a patch for D6 version of the module, but I think it will be very very simmilar for D7 version of Pathologic.
I hope it would work good and I hope there is no links that contains encoded html.
Comment #3
dealancer CreditAttribution: dealancer commentedComment #4
Garrett Albright CreditAttribution: Garrett Albright commentedSo CKEditor is encoding entities in paths as HTML entities, which it shouldn't be doing. Doesn't this completely screw up your links whether you're using Pathologic or not?
Arg. Working with Pathologic would be so much more fun if I weren't constantly being demanded to work around WYSIWYG editors doing stupid crap.
Comment #5
dealancer CreditAttribution: dealancer commented> So CKEditor is encoding entities in paths as HTML entities, which it shouldn't be doing.
I think that not only CKeditor does this.
> Doesn't this completely screw up your links whether you're using Pathologic or not?
No, other links works ok. html entities are decoded by browser. Check your own:
Only links processed by both CKedior and Pathologic are damaged.
> Arg. Working with Pathologic would be so much more fun if I weren't constantly being demanded to work around WYSIWYG editors doing stupid crap.
Please look on the patch, it contains only one line of code:
Here is a prove that this patch works 100%. There is 0 probability that there can be html entities in links added by user manually, anyway all of them will be decoded by browser. And there is a big possibility that links will be encoded by CKeditor or any other WYSIWYG editor. So we just need to decode it in Pathologic, before browser does this.
What do you think?
Comment #6
dealancer CreditAttribution: dealancer commentedThis patch works and prevents issue with Pathologic + WYSIWYG. The real problem:
Comment #7
fearlsgroove CreditAttribution: fearlsgroove commentedNot so. Ampersands are supposed to be encoded in URLs, WYSIWYG editors that convert & to & are doing exactly what they're supposed to be doing.
Comment #8
dealancer CreditAttribution: dealancer commentedGreat, so the patch in comment #2 should be reviewed and committed.
Comment #9
fearlsgroove CreditAttribution: fearlsgroove commentedNot sure .. why are we decoding then decoding again? What if we just remove the decode from the URL, since URLs are supposed/allowed to be encoded.
Comment #10
dealancer CreditAttribution: dealancer commented@fearlsgroove, the real problem is that pathologic do wrong decoding: it replaces "& a m p ;" to "& ;". It should not do such replacement or make replacement correctly. I could not find bug, cause of difficult regular expressions, so just provided quick fix in a one line. I appreciate if you could help us to find and fix the real issue of wrong decoding.
Comment #11
artis CreditAttribution: artis commentedthis issue persists in 7.x-2.0-beta2
Comment #12
artis CreditAttribution: artis commentedPatch at #2 works for 7.x-1.4.
7.x-2.0-beta is too dramatic of a change for the patch to work.
Comment #13
hass CreditAttribution: hass commentedI have disabled entities in CKEditor module... Does this help? We don't need them as Drupal is UTF8.
Comment #14
hass CreditAttribution: hass commentedDisable entities in CKEditor, please.
Comment #15
dealancer CreditAttribution: dealancer commentedhm....
> Disable entities in CKEditor, please.
How could I technically do it?
Also, if entities are disabled, that means that user could not embed < and >, because they will be processed as tags. That is wrong, I guess, not a good solution for this issue.
So changing status to Needs Work.
Comment #16
hass CreditAttribution: hass commentedThere is a checkbox in ckeditor profile settings. Links can be added with other link or ckeditor_link module. Both works well.
Comment #17
dealancer CreditAttribution: dealancer commented1) I could not find this checkbox. I am speaking about WYSIWYG module. Please do not close the issue, until it is not solved yet.
2) THERE IS STILL AN ISSUE IN PATHALOGIC MODULE.
For some reason pathologic replaces &_a_m_p_; to &; but it should replace &_a_m_p_; to &. Got it? There is a difference between &; and &, isn't it?
Comment #18
hass CreditAttribution: hass commentedI used WYSIWYG in past. I'm using CKEditor module as WYSIWYG is not useable if you need to rearange/limit the buttons. Nothing goes forward with this module.
Comment #19
Garrett Albright CreditAttribution: Garrett Albright commentedClosing for now since this doesn't seem to be Pathologic related.
Comment #20
meecect CreditAttribution: meecect commentedI think dealancer is correct. It seems like pathologic is not properly parsing url arguments that have html encodings and are valid HTML. I wrote a detailed comment to what is basically the same issue in the 6.x branch.
Please see my comment here:
http://drupal.org/node/419826#comment-7140614
Let me know and I can roll a similar patch to my solution in http://drupal.org/node/419826#comment-7140614 (and similar to the patch in #2).
Comment #20.0
meecect CreditAttribution: meecect commentedurls weren't quite right
Comment #21
Garrett Albright CreditAttribution: Garrett Albright commented6.x branch bugs will never be fixed. Sorry.