I've defined some resource types in CKFinder 3. From my config.php
, here are the back end and resource type definitions:
$config['backends'][] = [
'name' => 'default',
'adapter' => 'local',
'baseUrl' => '/images',
'root' => '/var/www/mysite/images',
'chmodFiles' => 0640,
'chmodFolders' => 0750,
'filesystemEncoding' => 'UTF-8'
];
$config['resourceTypes'][] = [
'name' => 'Images',
'maxSize' => "2M",
'url' => '/images',
'allowedExtensions' => 'gif,jpeg,jpg,png,pdf',
'backend' => 'default'
];
When I use one to select an image in CKEditor (using the standard image2
plugin), it adds a trailing slash after the baseURL
and before the rest of the path. Browsing and uploading all works correctly, and I can see that internally it's not using extra slashes on folder or file names, yet when I select an image from there in CKEditor, it gains this extra slash:
The URL of the selected image should be /images/apitest/butterfly.png
, but it's returning /images//apitest/butterfly.png
I can see that this does not happen on the CKEditor site demos, but I can't see that I'm doing anything different.
It may be that this is happening in other places, but it's common for double-slashes in URLs to be ignored, so it may not be causing any obvious problems.
you're missing "directory"
config key. If you add this then everything will be ok.
Currently it is marked as optional in the docs. So it should be updated to either as not optional or make it behave the same with empty "directory"
config key.