Open markpbaggett opened 1 month ago
Just a note that it looks like the RDF spec requires that URIs are encoded so this is almost certainly something Fedora is doing when a new resource is minted. For that reason, I don't see why irIIIFService would even need to encode these bits to begin with.
Just adding to this ticket. It looks like this is also a problem on DSpace now. It wasn't originally (the affected collection worked), but it is now. Oddly, the error is reported as a 500:
2024-10-28 20:43:12.829 ERROR 1 --- [-8080-exec-1138] e.t.i.service.AbstractManifestService : Failed to get RDF for https://oaktrust.library.tamu.edu/server/rdf/handle/1969.1/169475/10/0003%20Front%20Map%20with%20Booklet.jpg: 500 500: "{"timestamp":"2024-10-28T20:43:12.826+00:00","status":500,"error":"Internal Server Error","message":"The request was rejected because the URL contained a potentially malicious String \"%25\"","path":"/server/rdf/handle/1969.1/169475/10/0003%2520Front%2520Map%2520with%2520Booklet.jpg"}"
2024-10-28T20:43:12.832248496Z 2024-10-28 20:43:12.831 DEBUG 1 --- [-8080-exec-1138] e.t.i.service.AbstractManifestService : Error while requesting RDF for https://oaktrust.library.tamu.edu/server/rdf/handle/1969.1/169475/10/0003%20Front%20Map%20with%20Booklet.jpg: 500 500: "{"timestamp":"2024-10-28T20:43:12.826+00:00","status":500,"error":"Internal Server Error","message":"The request was rejected because the URL contained a potentially malicious String \"%25\"","path":"/server/rdf/handle/1969.1/169475/10/0003%2520Front%2520Map%2520with%2520Booklet.jpg"}"
2024-10-28T20:43:12.832267329Z
2024-10-28T20:43:12.832271910Z org.springframework.web.client.HttpServerErrorException$InternalServerError: 500 500: "{"timestamp":"2024-10-28T20:43:12.826+00:00","status":500,"error":"Internal Server Error","message":"The request was rejected because the URL contained a potentially malicious String \"%25\"","path":"/server/rdf/handle/1969.1/169475/10/0003%2520Front%2520Map%2520with%2520Booklet.jpg"}"
2024-10-28T20:43:12.832346592Z at org.springframework.web.client.HttpServerErrorException.create(HttpServerErrorException.java:100) ~[spring-web-5.3.24.jar!/:5.3.24]
2024-10-28T20:43:12.832380893Z at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:170) ~[spring-web
-5.3.24.jar!/:5.3.24]
Describe the bug In some cases, irIIIFService will try to request a Fedora resource by encoding parts of a URI from Fedora that has already been encoded. This causes irIIIFService to fail to request the RDF resource with a 404 and results in the Manifest not generating.
To Reproduce Steps to reproduce the behavior:
Manifest
in thisCollection
: https://api-pre.library.tamu.edu/iiif-service/fedora/collection/bb/97/f2/3e/bb97f23e-803a-4bd6-8406-06802623554c/basbanes-exhibit-texts-20240924https://api-pre.library.tamu.edu/iiif-service/fedora/presentation/bb/97/f2/3e/bb97f23e-803a-4bd6-8406-06802623554c/basbanes-exhibit-texts-20240924_objects/17
RDF not found! https://api-pre.library.tamu.edu/fcrepo/rest/bb/97/f2/3e/bb97f23e-803a-4bd6-8406-06802623554c/basbanes-exhibit-texts-20240924_objects/17/pages/page_0/files/blumberg-holiday%20card_1.jpg/fcr:metadata
, but that URL resolves to a200
. Hmmmmm. 🤔o.s.web.client.RestTemplate : HTTP GET [https://api-pre.library.tamu.edu/fcrepo/rest/bb/97/f2/3e/bb97f23e-803a-4bd6-8406-06802623554c/basbanes-exhibit-texts-20240924_objects/17/pages/page_0/files/blumberg-holiday%2520card_1.jpg/fcr:metadata](https://api-pre.library.tamu.edu/fcrepo/rest/bb/97/f2/3e/bb97f23e-803a-4bd6-8406-06802623554c/basbanes-exhibit-texts-20240924_objects/17/pages/page_0/files/blumberg-holiday%2520card_1.jpg/fcr:metadata) 2024-09-27 14:07:46.864 DEBUG 1 --- [nio-8080-exec-4] o.s.web.client.RestTemplate : Accept=[text/plain, application/json, application/*+json, */*] 2024-09-27 14:07:46.898 DEBUG 1 --- [nio-8080-exec-4] o.s.web.client.RestTemplate : Response 404 NOT_FOUND 2024-09-27 14:07:46.899 ERROR 1 --- [nio-8080-exec-4]
blumberg-holiday%2520card_1.jpg
. In Fedora, it isblumberg-holiday%20card_1.jpg
, and on disk it wasblumberg-holiday card_1.jpg
. In other words, we have a file with spaces, Fedora (or MAGPIE) encodes the space as%20
, and then irIIIFService thinks the%
needs be encoded as%25
, and we end up with%2520
.Expected behavior irIIIFService attempts to determine if a resource uri is already encoded instead of reencoding.
Screenshots
Full trace back:
Additional context
A couple of things worth thinking about: