gallery3 icon indicating copy to clipboard operation
gallery3 copied to clipboard

Remove code using compare_uri

Open jpschewe opened this issue 1 year ago • 3 comments

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

jpschewe avatar Mar 15 '23 03:03 jpschewe

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

jpschewe avatar Mar 15 '23 11:03 jpschewe

This will fix #22

jpschewe avatar Mar 16 '23 00:03 jpschewe

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.

jpschewe avatar Mar 16 '23 12:03 jpschewe