When using KCFinder on a multilingual site with clean URLs enabled I get a 404 error when I try to open it from CKEditor.

After some digging, I realized that the path to the KCFinder files generated by the funtion kcfinder_pathfind is wrong. The url function adds a language prefix to the path, thus the 404 error. For example, when my current language is German, the generated path is /de/sites/all/modules/kcfinder/kcfinder_files/ instead of /sites/all/modules/kcfinder/kcfinder_files/.

The attached patch solved the problem for me

Comments

setvik’s picture

Priority: Normal » Major
StatusFileSize
new751 bytes

Works for me.

Rerolling to apply from module directory (ala: http://drupal.org/node/1141686/git-instructions/7.x-1.x)

danyalejandro’s picture

Status: Needs review » Closed (fixed)

Thanks a lot! commited. Will activate the new release as soon as the KCFinfer project releases it's next version (it will come as a separate download)

muzius’s picture

Version: 7.x-1.x-dev » 7.x-1.85
Priority: Major » Minor
Status: Closed (fixed) » Needs review

this patch did solve the problem but now drupal complains:
Notice: Trying to get property of non-object a locale_language_url_rewrite_url()

The problem arises when another module uses url() function specifying the language as a string "es" or "fr" for example, instead of a language object. Found the source of the problem in line 51 of kcfinder.inc.php, to get rid of this message either use the default language (which should have no prefix):

return url(variable_get('kcfinder_library_path'), array('absolute' => TRUE,'language' => language_default() ));

or provide a fake language module without prefix (maybe the safer solution):

return url(variable_get('kcfinder_library_path'), array('absolute' => TRUE,'language' => (object) array('language' => 'none', 'name' => 'none', 'prefix' => '') ));

thanks for your work on the kcfinder-integration, very much appreciated!

danyalejandro’s picture

Assigned: Unassigned » danyalejandro