1j01 / jspaint

🎨 Classic MS Paint, REVIVED + ✨Extras
https://jspaint.app/about
MIT License
7.16k stars 562 forks source link

Errors trying to paste/open an SVG file #337

Open 1j01 opened 3 months ago

1j01 commented 3 months ago

Trying to paste an SVG image I copied to the clipboard (the uBlock Origin logo), I got an error:

InvalidStateError: CanvasRenderingContext2D.drawImage: Passed-in canvas is empty

make_canvas/new_ctx.copy@https://jspaint.app/src/helpers.js:175:13
make_canvas@https://jspaint.app/src/helpers.js:187:12
instantiate@https://jspaint.app/src/OnCanvasSelection.js:50:19
instantiate@https://jspaint.app/src/OnCanvasSelection.js:145:3
OnCanvasSelection@https://jspaint.app/src/OnCanvasSelection.js:22:8
paste/do_the_paste/<@https://jspaint.app/src/functions.js:1669:16
undoable@https://jspaint.app/src/functions.js:1910:14
do_the_paste@https://jspaint.app/src/functions.js:1664:11
paste/<@https://jspaint.app/src/functions.js:1641:5

Saving it and trying to open it instead, I got a different error:

IndexSizeError: Index or size is negative or greater than the allowed amount

canvas_has_any_apparent_image_data@https://jspaint.app/src/sessions.js:23:19
handle_data_loss@https://jspaint.app/src/sessions.js:89:8
LocalSession/this.save_image_to_storage_immediately@https://jspaint.app/src/sessions.js:111:25
later@https://jspaint.app/src/helpers.js:51:11

(replace https://jspaint.app/ with https://github.com/1j01/jspaint/blob/a0abbb3e367b864c0b157c1eefe6e7e1b4112849/ in stack traces for permalinks)