ruven / iipsrv

iipsrv is an advanced high-performance feature-rich image server for web-based streamed viewing and zooming of ultra high-resolution images.
https://iipimage.sourceforge.io
GNU General Public License v3.0
291 stars 115 forks source link

+ in filename-problems with IIIF support #195

Open Knurg opened 4 years ago

Knurg commented 4 years ago

I've still some problems with + in filenames and IIIF:

I have a file "Gm1161+1187_XR_WissKI.tif" in my cms that I want to get via iip-srv.

Initially I started by fetching from https://tafelmalerei.gnm.de/fcgi-bin/iipsrv.fcgi?IIIF=/srv/www/htdocs/sites/default/files/styles/wisski_pyramid/public/2018-07/Gm1161+1187_XR_WissKI.tif/full/full/0/default.jpg which gave me a:

/srv/www/htdocs/sites/default/files/styles/wisski_pyramid/public/2018-07/Gm1161 1187_XR_WissKI.tif is neither a file nor part of an image sequence

So i fiddled around a bit - single-encoding did not work, but double-encoding does, so I get the image when I query: https://tafelmalerei.gnm.de/fcgi-bin/iipsrv.fcgi?IIIF=/srv/www/htdocs/sites/default/files/styles/wisski_pyramid/public/2018-07/Gm1161%252B1187_XR_WissKI.tif/full/full/0/default.jpg

However if I query the info.json via https://tafelmalerei.gnm.de/fcgi-bin/iipsrv.fcgi?IIIF=/srv/www/htdocs/sites/default/files/styles/wisski_pyramid/public/2018-07/Gm1161%252B1187_XR_WissKI.tif/info.json I get a json file which is corrupted:

{
  "@context" : "http://iiif.io/api/image/2/context.json",
  "protocol" : "http://iiif.io/api/image",
  "width" : 5722,
  "height" : 15386,
  "sizes" : [
     { "width" : 44, "height" : 120 },
     { "width" : 89, "height" : 240 },
     { "width" : 178, "height" : 480 },
     { "width" : 357, "height" : 961 },
     { "width" : 715, "height" : 1923 }
  ],
  "tiles" : [
     { "width" : 256, "height" : 256, "scaleFactors" : [ 1, 2, 4, 8, 16, 32, 64, 128 ] }
  ],
  "@id" : "https://tafelmalerei.gnm.de/fcgi-bin/iipsrv.fcgi?IIIF=/srv/www/htdocs/sites/default/files/styles/wisski_pyramid/public/2018-07/Gm1161

Can we do something about that? I have a fresh compiled iipsrv in the most recent version.

ruven commented 4 years ago

OK, I've committed a fix that should solve your problem - it was just an issue with the % symbol and printf(). Let me know if this works for you

Knurg commented 4 years ago

Thanks for the fix. The info.json works well now: https://tafelmalerei.gnm.de/fcgi-bin/iipsrv.fcgi?IIIF=/srv/www/htdocs/sites/default/files/styles/wisski_pyramid/public/2018-07/Gm1161%252B1187_XR_WissKI.tif/info.json But in there it refers to: https://tafelmalerei.gnm.de/fcgi-bin/iipsrv.fcgi?IIIF=/srv/www/htdocs/sites/default/files/styles/wisski_pyramid/public/2018-07/Gm1161%2B1187_XR_WissKI.tif And this fails the loads for mirador as a consequence - it would have to be https://tafelmalerei.gnm.de/fcgi-bin/iipsrv.fcgi?IIIF=/srv/www/htdocs/sites/default/files/styles/wisski_pyramid/public/2018-07/Gm1161%252B1187_XR_WissKI.tif Best Mark

Am Fr., 6. März 2020 um 15:40 Uhr schrieb Ruven notifications@github.com:

OK, I've committed a fix that should solve your problem - it was just an issue with the % symbol and printf(). Let me know if this works for you

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ruven/iipsrv/issues/195?email_source=notifications&email_token=AAE6OFWK3STJ46LRZUTHIQDRGEDMJA5CNFSM4LC7MWL2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEOBSI7I#issuecomment-595797117, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAE6OFTPIUF4AVA36NYJK23RGEDMJANCNFSM4LC7MWLQ .

ruven commented 4 years ago

The @id parameter within info.json should be URI-encoded according to the IIIF specification https://iiif.io/api/image/2.1/#technical-properties and https://iiif.io/api/image/2.1/#uri-syntax where it specifically states that for the file identifier "Special characters must be URI encoded". So, it looks like the + symbol in your file name should be encoded just once within the info.json file to %2B.

Is this only a problem with Mirador or do other viewers have problems with this?

Knurg commented 4 years ago

I am unsure if it is not more or less a problem of iip.

Example: https://tafelmalerei.gnm.de/wisski/navigate/47/view

Here you can see the manifest - everything is double escaped with %252B: https://tafelmalerei.gnm.de/wisski/navigate/47/iiif_manifest

Here is the info.json: https://tafelmalerei.gnm.de/fcgi-bin/iipsrv.fcgi?IIIF=/srv/www/htdocs/sites/default/files/styles/wisski_pyramid/public/2018-07/Gm1161%252B1187_XR_WissKI.tif/info.json

As you can see: Every url is double encoded, but somehow the id in the info.json is not. I guess it should be - why does it skip the encoding here?

If you have a look at the javascript console at https://tafelmalerei.gnm.de/wisski/navigate/47/view you can see what mirador tries to find - it exactly uses the URL from the info.json-file and seems to expand from there on. I don't know if this is good/valid - but it breaks the viewer from there on.

Best

Mark

Am Mo., 9. März 2020 um 13:35 Uhr schrieb Ruven notifications@github.com:

The @id https://github.com/id parameter within info.json should be URI-encoded according to the IIIF specification https://iiif.io/api/image/2.1/#technical-properties and https://iiif.io/api/image/2.1/#uri-syntax where it specifically states that for the file identifier "Special characters must be URI encoded". So, it looks like the + symbol in your file name should be encoded just once within the info.json file to %2B.

Is this only a problem with Mirador or do other viewers have problems with this?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ruven/iipsrv/issues/195?email_source=notifications&email_token=AAE6OFQB2LR3ASAQCST6YNTRGTO7VA5CNFSM4LC7MWL2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEOG5XMI#issuecomment-596499377, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAE6OFW4RBKFPUPSQTNRQ7LRGTO7VANCNFSM4LC7MWLQ .

ruven commented 4 years ago

OK, so either Mirador is doing something wrong and should URI-encode the @id string or IIPImage is doing it wrong and should work with singly-encoded, not double-encoded URI's.

Hmmm, I'll have to look into this further and get back to you. We should check how other viewers handle this. Indeed, I'll have to look at why and whether it's necessary for IIPImage to use double-encoding ...