elFinder icon indicating copy to clipboard operation
elFinder copied to clipboard

Trimming the first character in the directory name when integrating into CKEditor5

Open besnovatyj opened this issue 6 months ago • 4 comments

Integration into CKEditor5 using https://github.com/Studio-42/elFinder/wiki/Integration-with-CKEditor-5.

The hash is generated using https://github.com/Studio-42/elFinder/issues/1564#issuecomment-237479979

If you pass not only the volumeId, but also an additional path to the directory, then the first character in the path to the directory is cut off in line 3334.

https://github.com/Studio-42/elFinder/blob/66f497515ab2a3e867648cfb410089d1a8d6d53f/php/elFinderVolumeDriver.class.php#L3334


Initial data:

$uploadTargetPath = 'documents_module';
$volumeId = 'fls1_';
$fileName = 'yadisk-3.jpg';
$hash = 'fls1_ZG9jdW1lbnRzX21vZHVsZS95YWRpc2stMy5qcGc';

Expected value: documents_module/yadisk-3.jpg The resulting value: ocuments_module/yadisk-3.jpg


As a result, the script returns an incorrect URL to the locally downloaded file.

 fm.exec('upload', {files: [file], target: uploadTargetHash}, void(0), uploadTargetHash)
                                .done(data => {
                                    if (data.added && data.added.length) {

In the code above, data.added contains an invalid URL to the file.

besnovatyj avatar Aug 15 '24 15:08 besnovatyj