Menu

#18 url encoding from CK Editor "Browse Server"

open
nobody
None
5
2011-04-07
2011-04-07
No

Hi, I had a problem that when using CK Editor and "Browse Server", when selecting files with a space in the name (amongst other things), the filename would be taken literally, and neither CK Editor or PGR would encode. so "hello world.pdf" would just then appear as a linked document and break the server. Obviously I wanted it to, on select, change the link to "hello%20world.pdf".

CK Editor forums have other people with this problem, but CK just say it is the role of the file manager, and can't see anything where PGR could/should do it.

I did manage to COBBLE something together, so if anyone else has this problem and needs to HACK the code ( I say this as I know what else this may have broken, but sorted my problem out so far, but would appreaciate some feedback from PGR if they could make this an option or something) the i did the following.

In the PGRFileManager.js file, down the bottom find the "sendUrl" function and change it to that below. As you will see, I have just put encodeURIComponent() in around the returned filename. If anyone else knows why/if this is wrong etc, the please correct me, but just thought if anyone was in a corner like me last night, then this may give some reprieve.

function sendUrl(e, obj)
{
//For fckeditor
if (window.opener && window.opener.SetUrl) {
window.opener.SetUrl(options.rootDir + currentDir + "/" + encodeURIComponent(obj.attr("filename")));
window.close() ;
} else if(window.opener && window.opener.CKEDITOR) {
window.opener.CKEDITOR.tools.callFunction(options.ckEditorFuncNum, options.rootDir + currentDir + "/" + encodeURIComponent(obj.attr("filename")));
window.close() ;
}else {
preview();
}
}

Discussion


Log in to post a comment.

Monday.com Logo