https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42189

--- Comment #53 from Paul Derscheid <[email protected]> ---
Created attachment 198939
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=198939&action=edit
Bug 42189: (QA follow-up) Use Asset.js attrs and Asset.url for ESM

- Drop the hand-rolled
    [% SET x = Asset.js("foo.esm.js").match('src="([^"]+)"').0 %]
  pattern; use Asset.js's existing attributes hashref to emit
  the type="module" nonced script tag, and Asset.url(path) for
  URL-only callers (importmap entries, inline import statements)
- The original regex re-parsed Asset.js's own output back into
  a URL, so a future change to its tag format (extra attribute,
  different quote style) would silently break every consumer
- Asset.css already takes attributes the same way (see
  t/db_dependent/Koha/Template/Plugin/Asset.t for the
  media="print" example), so this is an existing pattern
- Fix wrapper-staff-tool-plugin.inc which the original patch
  missed; it still carried the old double-capture regex and the
  redundant nonce-less <script> tag that was removed from
  main-container.inc

To test:
- prove t/db_dependent/Koha/Template/Plugin/Asset.t
- yarn js:build and load each affected page:
    /cgi-bin/koha/acqui/vendors.pl
    /cgi-bin/koha/admin/record_sources.pl
    /cgi-bin/koha/erm/erm.pl
    /cgi-bin/koha/preservation/home.pl
    /cgi-bin/koha/sip2/sip2.pl
    any tool/report plugin (uses wrapper-staff-tool-plugin.inc)
- View source; confirm each bundle is loaded via
  <script src="..." type="module" nonce="..."></script>

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to