gallery3
gallery3 copied to clipboard
Remove code using compare_uri
After installing 3.1.5 I found that I could no longer view images in galleries without guest permissions. I tracked the issue down to this change where compare_uri was constructed instead of using request_uri. When I switched back to using compare_uri as was used in 3.1.3 everything started working again.
Note that my gallery installation is not at the root of my host, but at https://host.com/gallery
To find this I added log statements that shows the transformation of the URI. Access to this URI is to be allowed
2023-03-15 03:16:12 +00:00 --- error: request: /gallery/var/albums/jpschewe/security/security-2008-09-29/pict0006.jpg
2023-03-15 03:16:12 +00:00 --- error: ltrim(request): gallery/var/albums/jpschewe/security/security-2008-09-29/pict0006.jpg
2023-03-15 03:16:12 +00:00 --- error: url::file(ltrim(request)): /gallery/gallery/var/albums/jpschewe/security/security-2008-09-29/pict0006.jpg
2023-03-15 03:16:12 +00:00 --- error: rawurldecode(url::file(ltrim(request))): /gallery/gallery/var/albums/jpschewe/security/security-2008-09-29/pict0006.jpg
This will fix #22
I dug into the functions more thinking that perhaps I had a misconfiguration. Looking at the source for url::file
I see that it prepends the base url. When I add debug code to output url::base()
I find that it's properly set to /gallery/
. However request_uri
already has the base url prepended, so calling url::file
with it causes the base url to be prepended a second time.