Skip to content

Inline source map with extended data uri syntax causes an error #25

Closed
@asapach

Description

@asapach

One of the libraries I'm using has the following inline source map:

//# sourceMappingURL=data:application/json;charset=utf-8;base64,...

This doesn't match the regexp: /data:[^;\n]+;base64,(.*)/, because it specifies an encoding in the mediatype, but it's perfectly valid according to the spec: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs

This results in the wrong code path being taken and the data URI is interpreted as a URL, which results in an error: Cannot find SourceMap 'data:application/json;charset=utf-8;base64,...

I suggest relaxing the regexp to allow semicolon: /data:[^\n]+;base64,(.*)/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions