8000 fix(frontend): fix dompurify.sanitize import by neocturne · Pull Request #6096 · hedgedoc/hedgedoc · GitHub
[go: up one dir, main page]

Skip to content

fix(frontend): fix dompurify.sanitize import - #6096

Merged
ErikMichelson merged 1 commit into
hedgedoc:developfrom
neocturne:dompurify-fix
Jul 7, 2025
Merged

ErikMichelson merged 1 commit into
hedgedoc:developfrom
neocturne:dompurify-fix

Conversation

@neocturne
Copy link
Copy Markdown
Contributor

Component/Part

Frontend

Description

The update to dompurify 3.2.4 (902abf7) broke the import of dompurify.sanitize, which now fails with a TypeScript error (likely related to the introduction of type definitions in 3.2.0). Using the DOMPurify default export fixes the issue.

The issue is reproducible both with the local development server and with the published frontend container; without this fix, the frontend is completely broken.

Steps

  • Added implementation
    made sure that:
    • My commits are signed-off to accept the DCO.
    • This PR targets the correct branch: master for 1.x & docs, develop for 2.x

Related Issue(s)

The update to dompurify 3.2.4 broke the import of dompurify.sanitize,
which now fails with a TypeScript error (likely related to the
introduction of type definitions in 3.2.0). Using the DOMPurify default
export fixes the issue.

Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
@codecov
codecov Bot commented Jul 7, 2025 •
Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.88%. Comparing base (e7f33c9) to head (b40a937).
Report is 326 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff              @@
##           develop    #6096       +/-   ##
============================================
+ Coverage    57.66%   84.88%   +27.22%     
============================================
  Files          418      150      -268     
  Lines        12058     4479     -7579     
  Branches      1007      545      -462     
============================================
- Hits          6953     3802     -3151     
+ Misses        5048      638     -4410     
+ Partials        57       39       -18     
Flag Coverage Δ
backend 84.88% <ø> (-2.74%) ⬇️
backend-e2e-tests 72.62% <ø> (-1.72%) ⬇️
backend-unit-tests 86.33% <ø> (+0.60%) ⬆️
e2e-tests 72.62% <ø> (-1.72%) ⬇️
frontend ?
frontend-unit-tests ?
unit-tests 86.33% <ø> (+34.53%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cypress
cypress Bot commented Jul 7, 2025
Copy link
Copy Markdown

HedgeDoc    Run #8066

Run Properties:  status check failed Failed #8066  •  git commit b40a937621: fix(frontend): fix dompurify.sanitize import
Project HedgeDoc
Branch Review dompurify-fix
Run status status check failed Failed #8066
Run duration 05m 04s
Commit git commit b40a937621: fix(frontend): fix dompurify.sanitize import
Committer Matthias Schiffer
View all properties for this run ↗︎

Test results
Tests that failed  Failures 45
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 2
Tests that passed  Passing 43
View all changes introduced in this branch ↗︎

Tests for review

Failed  documentTitle.spec.ts • 12 failed tests • chrome

View Output

Test Artifacts
Document Title > title should be yaml metadata title > just yaml metadata title Test Replay Screenshots
Document Title > title should be yaml metadata title > yaml metadata title and opengraph title Test Replay Screenshots
Document Title > title should be yaml metadata title > yaml metadata title, opengraph title and first heading Test Replay Screenshots
Document Title > title should be opengraph title > just opengraph title Test Replay Screenshots
Document Title > title should be opengraph title > opengraph title and first heading Test Replay Screenshots
Document Title > title should be first heading > just first heading Test Replay Screenshots
Document Title > title should be first heading > just first heading with alt-text instead of image Test Replay Screenshots
Document Title > title should be first heading > just first heading without link syntax Test Replay Screenshots
Document Title > title should be first heading > markdown syntax removed first Test Replay Screenshots
Document Title > title should be first heading > markdown syntax removed second Test Replay Screenshots
The first 10 failed tests are shown, see all 12 tests in Cypress Cloud.
Failed  linkSchemes.spec.ts • 10 failed tests • chrome

View Output

Test Artifacts
markdown formatted links to > external domains render as external link Test Replay Screenshots
markdown formatted links to > note anchor references render as anchor link Test Replay Screenshots
markdown formatted links to > internal pages render as internal link Test Replay Screenshots
markdown formatted links to > data URIs do not render Test Replay Screenshots
markdown formatted links to > javascript URIs do not render Test Replay Screenshots
HTML anchor element links to > external domains render as external link Test Replay Screenshots
HTML anchor element links to > note anchor references render as anchor link Test Replay Screenshots
HTML anchor element links to > internal pages render as internal link Test Replay Screenshots
HTML anchor element links to > data URIs do not render Test Replay Screenshots
HTML anchor element links to > javascript URIs do not render Test Replay Screenshots
Failed  taskLists.spec.ts • 4 failed tests • chrome

View Output

Test Artifacts
Task lists > do not render as checkboxes when invalid Test Replay Screenshots
Task lists > render with checkboxes > when unchecked Test Replay Screenshots
Task lists > render with checkboxes > when checked lowercase Test Replay Screenshots
Task lists > render with checkboxes > when checked uppercase Test Replay Screenshots
Failed  word-count.spec.ts • 3 failed tests • chrome

View Output

Test Artifacts
Test word count with > simple words Test Replay Screenshots
Test word count with > excluded codeblocks Test Replay Screenshots
Test word count with > excluded images Test Replay Screenshots
Failed  renderer-mode.spec.ts • 2 failed tests • chrome

View Output

Test Artifacts
Renderer mode > should be 'reveal.js' with type 'slide' Test Replay Screenshots
Renderer mode > should be 'document' with invalid type Test Replay Screenshots

The first 5 failed specs are shown, see all 13 specs in Cypress Cloud.

@ErikMichelson
ErikMichelson self-requested a review July 7, 2025 22:58
@ErikMichelson ErikMichelson left a comment
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for your contribution! 🎉

@ErikMichelson
ErikMichelson merged commit 4e9d152 into hedgedoc:develop Jul 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0