Skip to content

Ensure iiif manifests have id attributes by forcing UTF8 encoding of request.base_url#7542

Open
cjcolvar wants to merge 1 commit into
mainfrom
iiif_ids
Open

Ensure iiif manifests have id attributes by forcing UTF8 encoding of request.base_url#7542
cjcolvar wants to merge 1 commit into
mainfrom
iiif_ids

Conversation

@cjcolvar

Copy link
Copy Markdown
Member

Fixes

Fixes #7539

Summary

The issue here is that request.base_url has ASCII-8BIT encoding due to Rack's env having ASCII-8BIT strings and Loofah clears out ASCII-8BIT strings. Instead of trying to change Loofah's or Rack's behavior this commit does the most minimal change by forcing base_url into UTF8 encoding before passing it into the iiif_manifest_presenter. Loofah being applied to all of the manifest's values including id happens in ManifestBuilderService#deep_sanitize that was added as part of 4e5536d.

Guidance for testing, such as acceptance criteria or new user interface behaviors:

  • Open the manifest for an item and ensure that the @id or id attribute is populated.
  • Check that the clover iiif viewer loads

@samvera/hyrax-code-reviewers

…request.base_url

The issue here is that request.base_url has ASCII-8BIT encoding due to Rack's env
having ASCII-8BIT strings and Loofah clears out ASCII-8BIT strings.  Instead of trying
to change Loofah's or Rack's behavior this commit does the most minimal change by
forcing base_url into UTF8 encoding before passing it into the iiif_manifest_presenter.
Loofah being applied to all of the manifest's values including id happens in
ManifestBuilderService#deep_sanitize that was added as part of 4e5536d.
@cjcolvar cjcolvar added the notes-bugfix Release Notes: Fixed a bug label Jul 15, 2026
@github-actions

github-actions Bot commented Jul 15, 2026

Copy link
Copy Markdown

Test Results

    17 files  ±0      17 suites  ±0   3h 31m 22s ⏱️ + 3m 5s
 7 953 tests +1   7 645 ✅ ±0  307 💤 ±0  1 ❌ +1 
27 174 runs  ±0  26 574 ✅  - 1  599 💤 ±0  1 ❌ +1 

For more details on these failures, see this check.

Results for commit 42c0e20. ± Comparison against base commit 105affd.

This pull request removes 448 and adds 449 tests. Note that renamed tests count towards both.
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplate:0x00007f1c5d45d5c8>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplate:0x00007f83678d9888>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplate:0x00007faf3f6d2e50>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplate:0x00007fec49a1e248>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007f1c5d4d9b00>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007f836b4cc318>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007faf53bdfdd0>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007fec49a13ac8>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy AdminSet: 560fbaf2-08af-457f-8c32-228c69b8371e
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy Hyrax::AdministrativeSet: 09d9014f-7935-48b0-9882-0f61fd52c86d
…
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplate:0x00007f463501d718>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplate:0x00007f68a010ac88>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplate:0x00007fad1969e4c0>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplate:0x00007fbb0967de98>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007f4635012f98>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007f68a3cfadd8>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007fad196cc0a0>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007fbb180cb400>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy AdminSet: 96671ff1-1511-44fa-91d6-7f1fb607b46f
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy Hyrax::AdministrativeSet: 0891bbc7-fa52-4a71-8b3a-16e3c08accc2
…

♻️ This comment has been updated with latest results.

@kirkkwang kirkkwang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch!

@kirkkwang

Copy link
Copy Markdown
Contributor

@cjcolvar i saw your CI run had the same issue mine did, added this to remedy it 942d8d4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

notes-bugfix Release Notes: Fixed a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IIIF manifests are not populating id in manifest document root, homepage, and thumbnail

2 participants