Skip to content

Commit

Permalink
Trailing query suffixes using the ? character are now stripped off th…
Browse files Browse the repository at this point in the history
…e IIIF quality/format string.

Fixes: #145
  • Loading branch information
ruven committed Jun 27, 2020
1 parent c58f206 commit d4a7018
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions ChangeLog
@@ -1,3 +1,8 @@
27/06/2020:
- Trailing query suffixes using the ? character are now stripped off the IIIF quality/format string.
Fixes: https://github.com/ruven/iipsrv/issues/145


26/06/2020:
- JPEG encoding re-written. Now more efficient with compressed data put directly into
output memory with no intermediate buffering and superfluous memory-memory copying.
Expand Down
8 changes: 7 additions & 1 deletion src/IIIF.cc
Expand Up @@ -531,7 +531,13 @@ void IIIF::run( Session* session, const string& src )
string quality = izer.nextToken();
transform( quality.begin(), quality.end(), quality.begin(), ::tolower );

size_t pos = quality.find_last_of(".");
// Strip off any query suffixes that use the ? character
// For example versioning such as ../default.jpg?t=23421232
size_t pos = quality.find_first_of("?");
if ( pos != string::npos ) quality = quality.substr( 0, pos );

// Check for a format specifier
pos = quality.find_last_of(".");

// Format - if dot is not present, we use default and currently only supported format - JPEG
if ( pos != string::npos ){
Expand Down

0 comments on commit d4a7018

Please sign in to comment.