Skip to content

Commit

Permalink
FAO Ticket 586: Serve files in zip if path matches but case-insensitive
Browse files Browse the repository at this point in the history
  • Loading branch information
MarieVerdonck committed Feb 20, 2025
1 parent b60cf2b commit ada1e06
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ public ResponseEntity retrieveAsset(@PathVariable UUID uuid, HttpServletResponse
RELATIVE_PATH_FIELD_NAME.qualifier,
"*");
// We may have links to directories in which case we need to serve the index.html in that directory.
return bitstreamPath.matches(path + "(/index\\.html)?");
// Add "(?i)" for case-insensitive match
return bitstreamPath.matches("(?i)" + path + "(/index\\.html)?");
})
.findFirst()
.get();
Expand All @@ -151,7 +152,7 @@ public ResponseEntity retrieveAsset(@PathVariable UUID uuid, HttpServletResponse

// If the found path deviates from the request path (for example, because it adds "/index.html"),
// then we should redirect. Otherwise, just serve the bitstream.
return foundPath.equals(path)
return foundPath.equalsIgnoreCase(path)
? makeBitstreamResponseEntity(response, request, context, asset, mimeType)
: redirectToEntryPoint(request, entrypoint);
} catch (Exception e) {
Expand Down

0 comments on commit ada1e06

Please sign in to comment.