Skip to content

Commit 0b9b301

Browse files
committed
Added extra URL decoding to ID field for IIIF's info.json. Fixes #270
1 parent ce0232e commit 0b9b301

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
06/09/2024:
2+
- Added extra URL decoding to ID field for IIIF's info.json. Fixes https://github.com/ruven/iipsrv/issues/270
3+
4+
15
05/09/2024:
26
- Added convenience function to Rawtile class to duplicate bands for encoders that cannot natively handle
37
single band monochrome images: simplifies WebP encoding.

src/IIIF.cc

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,11 +206,16 @@ void IIIF::run( Session* session, const string& src )
206206
string scheme = session->headers["HTTPS"].empty() ? "http://" : "https://";
207207

208208
if (request_uri.empty()){
209-
throw invalid_argument( "IIIF: REQUEST_URI was not set in FastCGI request, so the ID parameter cannot be set." );
209+
throw invalid_argument( "IIIF: REQUEST_URI was not set in FastCGI request, so the ID parameter cannot be set" );
210210
}
211211

212-
request_uri.erase( request_uri.length() - suffix.length() - 1, string::npos );
213-
id = scheme + session->headers["HTTP_HOST"] + request_uri;
212+
// Need to decode in case URL is encoded
213+
URL uri( request_uri );
214+
string decoded_uri = uri.decode();
215+
216+
// Remove the suffix and the preceding "/"
217+
decoded_uri.erase( decoded_uri.length() - suffix.length() - 1, string::npos );
218+
id = scheme + session->headers["HTTP_HOST"] + decoded_uri;
214219
}
215220

216221
// Decode and escape any URL-encoded characters from our file name for JSON

0 commit comments

Comments
 (0)