Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
besnovatyj opened this issue Aug 15, 2024 · 4 comments

Comments

@besnovatyj
Copy link

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

The hash is generated using #1564 (comment)

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.

$path = str_replace($this->separator, '/', substr($this->decode($hash), strlen(rtrim($this->root, '/' . $this->separator)) + 1));


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.

Copy link

github-actions bot commented Oct 5, 2024

This issue is stale because it has been open for 50 days with no activity.

@github-actions github-actions bot added the stale label Oct 5, 2024
@parpar78
Copy link

parpar78 commented Oct 9, 2024

Glad i am not the only one with this problem.
Is this package still maintained? Last update was 2023...

@nao-pon
Copy link
Member

nao-pon commented Oct 9, 2024

Will this be fixed by changing L.3334 to the following?

$path = str_replace($this->separator, '/', substr($this->decode($hash), strlen(trim($this->root, '/' . $this->separator))));

@besnovatyj
Copy link
Author

Will this be fixed by changing L.3334 to the following?

$path = str_replace($this->separator, '/', substr($this->decode($hash), strlen(trim($this->root, '/' . $this->separator))));

Yes, it works for me! :)

@github-actions github-actions bot removed the stale label Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants