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

Use of Laravel asset function in script.blade.php cause getFileUrl to return bad path #114

Closed
cbernard73 opened this issue Aug 23, 2016 · 7 comments
Labels
done Issue is fixed. Will be closed in 7 days.

Comments

@cbernard73
Copy link

On Jun 28 a change was made to line 5 of script.blade.php so that it now reads:

var image_url = "{{ asset(Config::get('lfm.images_url')) }}";

The asset function was added. The use of the asset function causes the trailing / of images_url to be removed.

Then getFileUrl remove the leading / here:

if (path.indexOf(ds) === 0) {
path = path.substring(1);
}

The result is a path like http:://localhost/images1/23423423.png

@streamtw
Copy link
Member

Thank you!
Will check this later.

@streamtw streamtw added the WIP Working in progress. label Aug 24, 2016
@Perpleex
Copy link

Perpleex commented Aug 24, 2016

Same problem with Ck-editor integration
Exemple :
http://localhost:8000/imagesshares/drap_oc1.gif

A similar problem occur when you try to delete a folder.

I create a exemple folder and i try to remove and the path is incorrect
C:\Users\Perpleex\Documents\Project/public/files/shares/sharesexemple not found!

Normally C:\Users\Perpleex\Documents\Project/public/files/shares/exemple
Shares is add two times and one without /

From what i see on js debug the trash method take in parameter item_name with sharesexemple inside the two are already concatenate without the /

On the call you use that href="javascript:trash('shares\exemple')"

But the trash method receive that :
sharesexemple something remove the slash but i don't see why something intercept the call i think if i escape the slash with a double \ it's good.
But at the end the controller add another share with the working_dir
C:\Users\Perpleex\Documents\RadioPaisLaraval/public/files/shares/shares\exemple not found!

So item_name not need shares at the start to work but something weird intercept the call and remove / on all function too

But for that a simple basename on folders.blade.php can do the job.

<a href="javascript:trash('{{ basename($dir_name['short']) }}')">

Some strange things too if you are in images mode and you create a new folder you comeback in file mode.

@streamtw
Copy link
Member

basename() function is buggy with Chinese characters.
We have to find out another solution.

@wallauschek
Copy link

script.blade.php

function getFileUrl(file) {
...
if (path != ds) {
item_url = item_url + ds + path + ds;
}

@streamtw streamtw added done Issue is fixed. Will be closed in 7 days. and removed WIP Working in progress. labels Sep 12, 2016
@streamtw
Copy link
Member

streamtw commented Sep 12, 2016

Root cause for #102, #103, #106.

@streamtw
Copy link
Member

streamtw commented Sep 12, 2016

Updating to 1.6.1 would solve this.

@FerchoCarcho
Copy link

FerchoCarcho commented Sep 14, 2016

that asset thing isnt good when you want to customize your files into a Database field. I removed it but now Im getting double /photos//rNd2zDCdanpj/sliders/57d86ded98d53.jpg slash after photos.
Can you explain why did you include asset?
EDIT : so adding url = url.replace(/\/\//g, "/"); Will fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
done Issue is fixed. Will be closed in 7 days.
Projects
None yet
Development

No branches or pull requests

5 participants