vaadin / docs

Official documentation for Vaadin and Hilla.
https://vaadin.com/docs
Other
29 stars 195 forks source link

Unintended upload of non-SVG files in the Icon Set Generator #1832

Open starg09 opened 2 years ago

starg09 commented 2 years ago

From the documentation, over at Components > Icons > Using a Third-Party Icon Set:

Icon Set Generator

The generator converts a folder of SVG files into definitions and corresponding Java enum definitions. You can then download the files and add them to your project.

(emphasis added)

However, due to what was (being fair) an user mistake, a folder was selected that held not only the intended svg files, but also a 8MB pdf that was accidentally downloaded in the same directory.

What I'd expect, based on the description, is for only SVG files found in the folder (and nested folders). Instead, the PDF file was not only uploaded, but included as an "icon", generating in turn a broken .js file and crashing the page if one were to try expanding the "Usage and contents" of the file.

As a potential fix, it'd be nice if the upload filtered the selection as to only upload svg files. But a warning if it detects anything strange located in the given folder could also work.

(Off-topic: Besides this one issue, the generator is pretty nice!)

jouni commented 2 years ago

Thanks! Yeah, the list of files should be filtered and only .svg files should be processed.

jouni commented 2 years ago

In case you are eager and willing to help out, here’s the place where the file list should be filtered: https://github.com/vaadin/docs/blob/latest/frontend/demo/component/icons/iconset-generator.ts#L221-L236

starg09 commented 2 years ago

In case you are eager and willing to help out, here’s the place where the file list should be filtered

Sure, thanks for pointing where to look into! Will try to work out a PR soon 😄