loris-imageserver / loris

Loris IIIF Image Server
Other
208 stars 87 forks source link

Fix HTTP resolver caching for identifiers containing url-encodable characters #504

Closed jamieparkinson closed 4 years ago

jamieparkinson commented 4 years ago

The HTTP resolver has been saving unquote(ident) keys in the cache, but looking up plain idents. That's meant that, for some identifiers, it's found nothing in the cache until just before it saves - after the resolved file has been downloaded again.

This PR fixes this behaviour by making sure to perform the unquote at the time of calculating the cache key. Since unquote is idempotent it doesn't break any existing code.

alexwlchan commented 4 years ago

Good spot! Can I persuade you to write a test for it? 😉

jamieparkinson commented 4 years ago

You can, although I have already tried and failed - I'll give it another crack