FIX: Allow SVG uploads if dimensions are a fraction of a unit (PR #13409)

UploadCreator counts the number of pixels in an file to determine if it is valid. pixels is calculated by multiplying the width and height of the image, as determined by FastImage.

SVG files can have their width/height expressed in a variety of different units of measurement. For example, ‘px’, ‘in’, ‘cm’, ‘mm’, ‘pt’, ‘pc’, etc are all valid within SVG files. If an image has a width of 0.5in, FastImage may interpret this as being a width of 0, meaning it will report the size as being 0.

However, we don’t need to concern ourselves with the number of ‘pixels’ in a SVG files, as that is irrelevant for this file format, so we can skip over the check for pixels == 0 when processing this file type.


This pull request has been mentioned on Discourse Meta. There might be relevant details there:

Looks good to me but I think the core spec failure is legit.