Skip to content

Uploading SVG data urls will result in an errno":-36,"code":"ENAMETOOLONG" #306

@BioRodney

Description

@BioRodney

SVG data urls are no longer recognized because the regex in isRemoteUrl doesn't take svg+xml as a mime type into account.

The following regex is used in isRemoteUrl:
/^ftp:|^https?:|^gs:|^s3:|^data:([\w-]+/[\w-]+)?(;[\w-]+=[\w-]+)*;base64,([a-zA-Z0-9/+\n=]+)$/

To match SVG data urls it should probably be like this:
/^ftp:|^https?:|^gs:|^s3:|^data:([\w-]+/[\w-]+(+([\w-]+)?)?(;[\w-]+=[\w-]+);base64,([a-zA-Z0-9/+\n=]+)$/
or like this
/^ftp:|^https?:|^gs:|^s3:|^data:([\w-]+/[\w-+]+)?(;[\w-]+=[\w-]+)
;base64,([a-zA-Z0-9/+\n=]+)$/

because the mime type for an SVG data url looks like this:
data:image/svg+xml;base64,

The current regex will not match because of the + between svg and xml. This means that with the current code the data url for a SVG file is not seen as remote and the whole of the data url is being used as the name of the file.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions