Repository navigation
Fix downloads for legacy digital URLs and FRBR cataloging lookups - #484
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 22 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
ℹ️ No critical issues — one prefilter tightening suggested inline.
Reviewed changes
This review covers the single commit that widens Digital Library record matching to legacy URL spellings and opens the two FRBR lookup routes to cataloguing roles.
- Broader digital-file prefilter —
FILE_CANDIDATE_FILTERand the slash-agnosticlikePattern()let relative, percent-encoded and JSON-escaped URLs reachlists(), which still makes the exact decoded, local-host comparison. - Exact index invalidation —
indexOutdated()now outdates the index only when a changed record really lists the file, so unrelated encoded URLs (e.g. a loan on another book) keep the cache warm. - FRBR lookups for cataloguers —
/api/opere/searchand/admin/frbr-lrm/opere/{id}/espressionimap tocatalog.manageby exact match. Both are GET-only routes inFrbrLrmPlugin, so no write surface is opened. Plugin settings stay operator-only. - Regression coverage — a stored-form × visibility matrix (cold and warm index), a negative case for similar names and off-site URLs, and role-boundary checks through the real
AdminAuthMiddleware.
claude-opus-5-5 | 𝕏
…rary folder in it fileNameOf() looks for /uploads/digital/ in the undecoded path, so a percent-encoded value can only name a local file when that prefix is there (with \/ slashes in JSON); only a Unicode escape can hide the prefix, and that arm is unchanged. Off-site links such as archive.org addresses with %20 no longer join every cold scan. The matrix test checks that those rows are not candidates while encoded local ones still are.
There was a problem hiding this comment.
✅ No new issues found. The prefilter tightening from the prior review landed cleanly.
Reviewed changes
This run covers fcbe8aa, which narrows the percent-encoding arms of the Digital Library candidate prefilter.
- Prefix-gated
%arms — eachLOCATE('%', …)arm inFILE_CANDIDATE_FILTERnow also requires the literal folder prefix (uploads/digital/infile_url/audio_url,uploads%digitalindigital_attachmentsso JSON\/still matches). Off-site percent-encoded links no longer reach the JSON parser, and no real match is lost:fileNameOf()needs the prefix unencoded anyway, and the\uarm still stands alone. - Direct prefilter regression check — the matrix test runs the filter against an encoded off-site row, an encoded local
file_urland a JSON-escaped attachment, and asserts that only the two local rows come back as candidates.
claude-opus-5-5 | 𝕏

Valid Digital Library attachments could appear on the book page and in API responses but return 403 when downloaded. The record search now includes legacy relative paths, percent-encoded names, JSON-escaped slashes and JSON Unicode escapes, then checks the exact decoded local URL. The same matching is used when refreshing a populated file index; unrelated encoded URLs do not invalidate it.
Cataloger and Archivist accounts can now use the book editor's FRBR work autocomplete and expression lookup. Only those two lookup routes gain the cataloging capability; plugin settings and unrelated roles remain restricted.
Validation:
bash scripts/ci-quality-local.shpasses: PHPStan level 5, dependency audits, frontend lint, locale/route parity, all 267 standalone PHP suites without skips, all CI integration suites, schema/migration behavior and setup-permissions.Follow-up to the review of #481. Refs #480.