scratchfoundation / scratch-gui

Graphical User Interface for creating and running Scratch 3.0 projects.
https://scratchfoundation.github.io/scratch-gui/develop/
BSD 3-Clause "New" or "Revised" License
4.47k stars 3.59k forks source link

Uploading an SVG as a costume or sprite crashes the image editor and costume selector #4817

Open infinitytec opened 5 years ago

infinitytec commented 5 years ago

Expected Behavior

The costume should upload and be editable

Actual Behavior

Describe what actually happens image

Steps to Reproduce

Upload an SVG as a costume or new sprite. In this case I was using my profile picture's source SVG.

Operating System and Browser

Windows 10 Firefox 66.0.5 and the offline 3.0 editor.

TropicSapling commented 3 years ago

I'm experiencing the same issue. It seems it only crashes when uploading some specific SVG files, like this one. Other SVGs seem to work fine. I also found this crash log in the console:

projects.bundle.js:51
gui Unhandled Error: Error: TypeError: Cannot read property 'getGradient' of undefined
    at s (https://scratch.mit.edu/js/projects.bundle.js:113:253101)
    at a (https://scratch.mit.edu/js/projects.bundle.js:113:253051)
    at D (https://scratch.mit.edu/js/projects.bundle.js:113:253323)
    at initialize.importSVG (https://scratch.mit.edu/js/projects.bundle.js:113:253528)
    at i.value (https://scratch.mit.edu/js/projects.bundle.js:155:143297)
    at i.A [as importSvg] (https://scratch.mit.edu/js/projects.bundle.js:118:5401)
    at i.value (https://scratch.mit.edu/js/projects.bundle.js:155:141901)
    at i.value (https://scratch.mit.edu/js/projects.bundle.js:155:139746)
    at ol (https://scratch.mit.edu/js/common.bundle.js:41:83371)
    at cs (https://scratch.mit.edu/js/common.bundle.js:41:101245)
    at t.unstable_runWithPriority (https://scratch.mit.edu/js/common.bundle.js:49:3844)
    at $n (https://scratch.mit.edu/js/common.bundle.js:41:45023)
    at ms (https://scratch.mit.edu/js/common.bundle.js:41:97717)
    at Xl (https://scratch.mit.edu/js/common.bundle.js:41:93871)
    at https://scratch.mit.edu/js/common.bundle.js:41:45314
    at t.unstable_runWithPriority (https://scratch.mit.edu/js/common.bundle.js:49:3844)
    at $n (https://scratch.mit.edu/js/common.bundle.js:41:45023)
    at Wn (https://scratch.mit.edu/js/common.bundle.js:41:45259)
    at Gn (https://scratch.mit.edu/js/common.bundle.js:41:45194)
    at M (https://scratch.mit.edu/js/common.bundle.js:41:114343)
    at Qt (https://scratch.mit.edu/js/common.bundle.js:41:22724)
Component stack:
    in i
    in Connect(i)
    in div
    in ft
    in i
    in Connect(i)
    in div
    in div
    in div
    in qh
    in InjectIntl(qh)
    in i
    in Connect(i)
    in i
    in Connect(i)
    in r
    in Connect(r)
    in i
    in Connect(i)
    in r
    in Connect(r)
    in r
    in Connect(r)
    in a
    in Connect(a)
    in div
    in I
    in div
    in I
    in Ll
    in a
    in Connect(a)
    in InjectIntl(Connect(a))
    in a
    in Connect(a)
    in Unknown
    in div
    in o
    in div
    in o
    in o
    in div
    in I
    in div
    in I
    in div
    in I
    in div
    in I
    in MediaQuery
    in SH
    in Connect(SH)
    in InjectIntl(Connect(SH))
    in a
    in Connect(a)
    in InjectIntl(Connect(a))
    in r
    in Connect(r)
    in r
    in Connect(r)
    in InjectIntl(Connect(r))
    in r
    in Connect(r)
    in r
    in Connect(r)
    in r
    in Connect(r)
    in r
    in Connect(r)
    in InjectIntl(Connect(r))
    in r
    in Connect(r)
    in InjectIntl(Connect(r))
    in r
    in Connect(r)
    in r
    in Connect(r)
    in a
    in Connect(a)
    in Unknown
    in IntlProvider
    in Connect(IntlProvider)
    in r
    in Connect(r)
    in InjectIntl(Connect(r))
    in A
    in Connect(A)
    in IntlProvider
    in r

EDIT: I'm using the online 3.0 editor with Windows 10 and Chrome 92.0.4515.131.