Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File names with comma no longer work #261

Closed
andersju opened this issue Oct 12, 2023 · 4 comments
Closed

File names with comma no longer work #261

andersju opened this issue Oct 12, 2023 · 4 comments

Comments

@andersju
Copy link

d978bfd "[a]dded ability to choose a particular page or slice in an image stack when using IIIF by using a comma delimitter after the file name", but unfortunately this breaks file names that contain ,, because the request URI isn't parsed correctly -- the comma and everything after it is chopped off from the file name in the decoding/filtering step, and is instead interpreted as a request for a certain page or slice.

Given the file /data/foo,bar.jp2:

Previously (6f3a93d):

Request URI mapped to iiif=%2Fdata%2Ffoo%2Cbar.jp2/info.json
Full Request is iiif=%2Fdata%2Ffoo%2Cbar.jp2/info.json
[1/1]: Command / Argument is iiif : %2Fdata%2Ffoo%2Cbar.jp2/info.json
IIIF handler reached
IIIF :: URL decoded to /data/foo,bar.jp2/info.json
FIF handler reached
FIF :: URL decoding/filtering: /data/foo,bar.jp2 => /data/foo,bar.jp2
FIF :: Image cache initialization
FIF :: JPEG2000 image detected
...

Since d978bfd:

Request URI mapped to iiif=%2Fdata%2Ffoo%2Cbar.jp2/info.json
Full Request is iiif=%2Fdata%2Ffoo%2Cbar.jp2/info.json
[1/1]: Command / Argument is iiif : %2Fdata%2Ffoo%2Cbar.jp2/info.json
IIIF handler reached
IIIF :: URL decoded to /data/foo,bar.jp2/info.json
IIIF :: Requested stack or page index: 0
FIF handler reached
FIF :: URL decoding/filtering: /data/foo => /data/foo
FIF :: Image cache initialization
/data/foo is neither a file nor part of an image sequence
Sending HTTP 404 Not Found
@ruven
Copy link
Owner

ruven commented Oct 12, 2023

Maybe the separator should be configurable. I notice that Cantaloupe also has multi-page functionality, but uses a semi-colon rather than a comma (https://cantaloupe-project.github.io/manual/5.0/images.html#Identifiers). Would a semi-colon be better? Or perhaps some other symbol? What other kinds of punctuation do you have in your image names?

@andersju
Copy link
Author

andersju commented Oct 12, 2023

I think making it configurable (like in Cantaloupe, which we switched from :)) is probably ideal (even just a #define would be good), but for our particular case semi-colon is definitely better than comma (and I suspect semi-colon is less common in file names in general).

(I'm unfortunately not sure what kinds of punctuation we use in file names, but we used the default ; delimiter in Cantaloupe, and if it's configurable we can always figure something out. In our case: we don't need multi-page functionality, so if I can't figure out a "safe" regular character I'd probably set it to some non-printable character to effectively disable it.)

@ruven ruven closed this as completed in 3539288 Oct 19, 2023
ruven added a commit that referenced this issue Oct 19, 2023
…ack slice selection. Now disabled by default unless IIIF_DELIMITER is set. Resolves: #261
@ruven
Copy link
Owner

ruven commented Oct 19, 2023

This should now be fixed. I've added a new IIIF_DELIMITER configuration parameter where you can specify exactly the kind of IIIF delimiter you want, which can be a character or even any arbitrary string. This feature is disabled by default and only activated if you set the IIIF_DELIMITER parameter.

@andersju
Copy link
Author

Yep, it works fine now. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants