Skip to content

Bug on getUrl function with HomeFolder #161

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

Closed
Solirio opened this issue Sep 10, 2015 · 6 comments
Closed

Bug on getUrl function with HomeFolder #161

Solirio opened this issue Sep 10, 2015 · 6 comments

Comments

@Solirio
Copy link

Solirio commented Sep 10, 2015

Hello everyone, (Be ready for my english, im french, so sorry if it's bad)

After hours of research on a bug inside my app, i think i found it in ElfinderBundle.

My path uploads/img/etablissements
My HomeFolder var can change all the time, but here is an exemple: 16/espace

So the complete url can be uploads/img/etablissements/16/espace

It work well with everything exept the url of the Img. When i watch the src i see:
uploads/img/etablissements//16/espace/myimg.jpg

You can see a double / between my path and my homeFolder.
It make sometimes problem in TinyMce editor, img were sometimes like corrupted or not found in the editor. Most of the time it work. But i can't let bug like that even if it happen not often.

I found the problem in ElFinderConfigurationReader.

Inside the getConfiguration function. There is this code:

if ($homeFolder !== '') { $homeFolder = '/'.$homeFolder.'/'; }

this var is used two times:
For the path of the backend in the $driverOptions array:
'path' => $path . $homeFolder

So path will be in my case uploads/img/etablissements/16/espace
It's good

And for the URL of content in the $driverOptions too:
'URL' => $this->getURL($parameter, $request, $homeFolder, $path)

The bug is inside getURL function:

sprintf('%s://%s%s/%s/%s', $request->getScheme(), $request->getHttpHost(), $request->getBasePath(), $path, $homeFolder)

U can see an other / is added between $path and $homeFolder.
But one was already added in the getConfiguration function.

It's maybe normal, maybe i don't understand everything, all i know is this double slash made somes bug on my app.

Have Good Day guys :)

@nicolasmure
Copy link

Hi,

maybe this can help you : #158 (comment)

@Solirio
Copy link
Author

Solirio commented Sep 10, 2015

Hi, thank u for the answer, in my case it doest not solve my problem, i will probably just override the getURL function.

The double "/" is not before the path, but between path and homefolder. I tryied ur solution, but not working.

@helios-ag
Copy link
Owner

Hi @Solirio, what is your dev platform (win/linux/macos)?

@Solirio
Copy link
Author

Solirio commented Sep 11, 2015

The problem appear on Windows and Linux Debian

@Invis1ble
Copy link

Hello, I have the same issue on Windows 7, not tested yet on Linux.

@Invis1ble
Copy link

In my case the bug also in extra slash between path and homeFolder in

: sprintf('%s://%s%s/%s/%s', $request->getScheme(), $request->getHttpHost(), $request->getBasePath(), $path, $homeFolder);
.
Patching this function seems solves issue.

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

4 participants