I have an issue where using the IMCE button in Ckeditor causes the popup to 404. I have tracked this down to the fact our Nginx configuration denies direct access to index.php for security reasons, and the popup path is explicitly "Drupal.settings.basePath + 'index.php?q=imce\x26app=ckeditor|sendto@ckeditor_setFile|&CKEditorFuncNum=' + editor._.filebrowserFnIMCE, width, height".

If I use the "Browse server" button through the "Image" dialog in ckeditor the path is correctly cleaned to /imce?app=ckeditor...etc.

I can't seem to find the js code that controls that browse server button but surely it's possible to clean the url in the same fashion through the imce plugin.
Found out that this is controlled by a setting "filebrowserBrowseUrl" that's generated in ckeditor_profile_settings_compile(). Could this not be used in the imce plugin.js as well? Also interested to see that the same plugin.js appears in the ckeditor library and the module for imce.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

acbramley’s picture

Issue summary: View changes
joelstein’s picture

I'm also interested in seeing clean URLs respected for the IMCE plugin. Without it, I was getting 404s because of a Fast 404 module conflict with the path "/index.php". Using clean URLs fixed the issue.

Reference #2087163: fast 404 and imce.

joelstein’s picture

Status: Active » Needs work

If you change line:

editor.popup(Drupal.settings.basePath + 'index.php?q=imce\x26app=ckeditor|sendto@ckeditor_setFile|&CKEditorFuncNum=' + editor._.filebrowserFnIMCE, width, height);

to:

editor.popup(Drupal.settings.basePath + 'imce?app=ckeditor|sendto@ckeditor_setFile|&CKEditorFuncNum=' + editor._.filebrowserFnIMCE, width, height);

it fixes the issue. However, this won't work for installations where clean URLs are disabled. Perhaps there's a way to pass a setting that contains the IMCE url?

joelstein’s picture

Status: Needs work » Needs review
FileSize
545 bytes

Status: Needs review » Needs work

The last submitted patch, 4: ckeditor-imce-clean-urls-2185735.patch, failed testing.

dasjo’s picture

Status: Needs work » Needs review
FileSize
2.37 KB

attached is a patch that fixes more url paths to work with nginx

Status: Needs review » Needs work

The last submitted patch, 6: 2185735_6.patch, failed testing.

chellman’s picture

Status: Needs work » Fixed

It looks like this issue has been fixed in the current 7.x-1.x dev release as part of this change: #2159403: Make CKEditor plugin system modular and clean. From ckeditor.lib.inc, line 819:

$settings['filebrowserBrowseUrl'] = url('imce', array('query' => array('app' => 'ckeditor|sendto@ckeditor_imceSendTo|')));

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.