Skip to content

fix(export): prevent crashes during export size validation - #4326

Merged
hamed-musallam merged 2 commits into
mainfrom
fix-export-dialog
Aug 26, 2026
Merged

fix(export): prevent crashes during export size validation#4326
hamed-musallam merged 2 commits into
mainfrom
fix-export-dialog

Conversation

@hamed-musallam

@hamed-musallam hamed-musallam commented Aug 25, 2026

Copy link
Copy Markdown
Member

Switching to Advanced mode could crash the app, clearing a size field could break the aspect ratio, and oversized exports failed silently with a cryptic error.

  • Fix crash when applying default values in Advanced mode
  • Do not reset empty/invalid fields to 1
  • Validate against the final rendered pixel size, not the raw input values, and reject sizes the browser cannot handle: less than 1 px per side, more than 32,767 px per side, or more than 268,435,456 px total
  • Fix broken size validation logic
  • Show clear error messages in the export dialog

@hamed-musallam

Copy link
Copy Markdown
Member Author

@hamed-musallam

hamed-musallam commented Aug 25, 2026

Copy link
Copy Markdown
Member Author

@Sebastien-Ahkrin

Could you review the changes after the refactoring you did for the export modal? I think everything is working well now.

Switching to Advanced mode could crash the app, clearing a size field
could break the aspect ratio, and oversized exports failed silently
with a cryptic error.

- Fix crash when applying default values in Advanced mode
- Do not reset empty/invalid fields to 1
- Validate against the final rendered pixel size, not the raw input
  values, and reject sizes the browser can't handle: less than 1 px
  per side, more than 32,767 px per side, or more than 268,435,456 px
  total
- Fix broken size validation logic
- Show clear error messages in the export dialog
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 25, 2026

Copy link
Copy Markdown

Deploying nmrium with  Cloudflare Pages  Cloudflare Pages

Latest commit: 79b0d69
Status: ✅  Deploy successful!
Preview URL: https://57b59fe4.nmrium.pages.dev
Branch Preview URL: https://fix-export-dialog.nmrium.pages.dev

View logs

@hamed-musallam hamed-musallam changed the title fix(export): fix crashes in export size validation fix(export): prevent crashes during export size validation Aug 25, 2026

@tpoisseau tpoisseau 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.

I'm not sure to prefer min={0} over min={1}

Otherwise, LGTM

@Sebastien-Ahkrin Sebastien-Ahkrin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM Thanks you !

@hamed-musallam

hamed-musallam commented Aug 25, 2026

Copy link
Copy Markdown
Member Author

I'm not sure to prefer min={0} over min={1}

Otherwise, LGTM

I think a minimum value of 1 is required for values in pixels, but for other units, we could allow values greater than 0.

@tpoisseau

Copy link
Copy Markdown
Contributor

I think a minimum value of 1 is required for values in pixels, but for other units, we could allow values greater than 0.

Ok, I have no strong opinion on this topic and I approved. Do what you think is better ;-)

@hamed-musallam
hamed-musallam merged commit 2f9b561 into main Aug 26, 2026
16 of 18 checks passed
@hamed-musallam
hamed-musallam deleted the fix-export-dialog branch August 26, 2026 07:14
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.

3 participants