Opened 14 years ago

Closed 12 years ago

#5527 closed Bug (fixed)

Anchor (#) in URL gets urlencoded when using CKEDITOR.tools.callFunction

Reported by: Jakob Owned by: Alfonso Martínez de Lizarrondo
Priority: Normal Milestone: CKEditor 3.6.3
Component: General Version: SVN (CKEditor) - OLD
Keywords: Confirmed Cc:

Description

When calling

CKEDITOR.tools.callFunction(2, "http://www.kajona.de/index.html#myanchor");

out of our custom filebrowser, CKEditor will convert the URL to

http://www.kajona.de/index.html%23myanchor

I guess this isn't a feature?

Attachments (2)

_samples.zip (1.7 KB) - added by Jakob 14 years ago.
Test file to pass an url with anchor via filebrowser. Copy into /_samples and open passing_urlanchor.html
5527.patch (494 bytes) - added by Alfonso Martínez de Lizarrondo 14 years ago.
Proposed patch

Download all attachments as: .zip

Change History (10)

comment:1 Changed 14 years ago by Garry Yao

Resolution: invalid
Status: newclosed

WFM, we haven't make any change of the passing arguments.

Changed 14 years ago by Jakob

Attachment: _samples.zip added

Test file to pass an url with anchor via filebrowser. Copy into /_samples and open passing_urlanchor.html

comment:2 Changed 14 years ago by Jakob

Hm, are you sure it's working for you? I tested it in FF, Chrome and IE8 on two machines. Now I found the reason: the function updateTargetElement() replaces the character '#' in the passed url by '%23'. What's the reason for replacing it? Or do I have to pass my url with the anchor in another way/format? I attached a test file for passing an url with anchor via a filebrowser.

comment:3 Changed 14 years ago by Wiktor Walc

Keywords: Confirmed added
Resolution: invalid
Status: closedreopened

Thanks for providing a nice example that helped me in reproducing it.

The problem is that you can have a file or a folder that contains # in it's name and this is the reason why it was introduced. Unfortunately this way anchors are broken.

comment:4 Changed 14 years ago by Alfonso Martínez de Lizarrondo

This is related to the discussion in #5534. My point of view is that the server script is the one that must encode special chars because at CKEditor is not possible to know if the # means an anchor in an html document or is part of the file name.

So I vote for removing the current replacement of # and use just whatever the server sends.

comment:5 Changed 14 years ago by Jakob

Alright, thanks for the explanation. I also think, that the encoding should be done on the server side.

Changed 14 years ago by Alfonso Martínez de Lizarrondo

Attachment: 5527.patch added

Proposed patch

comment:6 Changed 14 years ago by Alfonso Martínez de Lizarrondo

Owner: set to Alfonso Martínez de Lizarrondo
Status: reopenedreview

The patch just removes the encoding done in JS, and any such special characters must be encoded at the server because it's the only place where it can know if it's part of a file name or it marks an url fragment.

comment:7 Changed 12 years ago by Wiktor Walc

Milestone: CKEditor 3.6.3
Status: reviewreview_passed

True, the encoding must be done in the external file browser, definitely not in CKEditor.

Another example just to prove that's the way to go - the following file has a perfectly valid name: sale_%20_off.jpg

CKEditor has no information whether it is actually sale_%20_off.jpg that needs to be encoded or sale_ _off.jpg that is already encoded properly.

Review+ (at the same time, we should review the encoding of URLs in CKFinder).

comment:8 Changed 12 years ago by Alfonso Martínez de Lizarrondo

Resolution: fixed
Status: review_passedclosed

Fixed with [7388]

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy