Closed rromanw closed 2 years ago
Hey @rromanw thanks so much for the contribution!
What's the consequence of having the double slash? It's usually harmless, so where is it causing trouble?
Do you have any steps to reproduce, or perhaps even a test case, or just an example?
From your patch, I'm wary of what happens when something is a symlink, because realpath()
also resolves symlinks, which doesn't sound like it would be intentional. And indeed it causes the tests to fail on MacOS (weirdly not on Linux) as you can see.
It might be a better fix to do something like str_replace('//', '/', ...)
- but I'm keen to know more about what the real problem is.
Also, MP3_BASE is used to create default MP3_DIR, and MP3_DIR is used to compare with DOCUMENT_ROOT to check that we're allowed to read from it for security reasons. So it should match what's in DOCUMENT_ROOT.
This behaviour could probably do with some additional unit tests because that assumption might be totally wrong these days (it was usually true 12 years ago, and I think it might be usually false now)…
Hey @rromanw are you able to give me an example of how the double forward slash occurs, and some more information about your setup? Are you using nginx and php-fpm in docker, or some other setup? Can you give me an example of the MP3_BASE with the double forward slash?
I think I've fixed this properly in #66
When there are two froward slashes in the beginning (it happens) it breaks the paths.