0

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:

CKEditor screen shot

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.

Synchro
  • 35,538
  • 15
  • 81
  • 104

1 Answers1

1

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.

jodator
  • 2,445
  • 16
  • 29
  • I've added `'directory' => ''` to my resource configs and it makes no difference; it's still adding the slash. I tried various other strings like `/` and `images`, but that just results in permissions or folder not found errors. Shouldn't the resource simply inherit the backend's `root` property if `directory` is not set or empty in the resource type? – Synchro Jul 23 '15 at 10:41
  • For now you need to set some subfolder of backend, like: `"directory" => "images"` to remove that extra slash. It is reported as on [CKFinder issue tracker](https://github.com/ckfinder/ckfinder/issues/172). – jodator Jul 23 '15 at 12:32
  • For anyone searching for this, this bug has apparently been fixed and will be in the next CKFinder release (3.0.1?). – Synchro Aug 06 '15 at 07:36