You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Assume you have an HTML file that is UTF-8 encoded, and there is an emoji included in an href attribute of the <a> tag. The emoji is not escaped or anything else it is just a properly formed UTF-8 glyph. Such as:
<ahref="https://rusty.today/🏈">Test link</a>
When attempting to move that asset this error is thrown:
URIError: moveAssets transform: URI malformed
at encodeURIComponent (<anonymous>)
at String.replace (<anonymous>)
at AssetGraph.addAsset (/Users/rusty/Development/assetgraph/lib/AssetGraph.js:241:45)
at Html._vivifyRelation (/Users/rusty/Development/assetgraph/lib/assets/Asset.js:1090:50)
at /Users/rusty/Development/assetgraph/lib/assets/Asset.js:1108:34
at Array.map (<anonymous>)
at Html.get outgoingRelations [as outgoingRelations] (/Users/rusty/Development/assetgraph/lib/assets/Asset.js:1107:73)
at gatherExternalRelations (/Users/rusty/Development/assetgraph/lib/assets/Asset.js:1180:44)
at Html.get externalRelations [as externalRelations] (/Users/rusty/Development/assetgraph/lib/assets/Asset.js:1187:7)
at Html.set url [as url] (/Users/rusty/Development/assetgraph/lib/assets/Asset.js:1022:37)
at /Users/rusty/Development/assetgraph/lib/util/assetMover.js:21:17
at moveAssets (/Users/rusty/Development/assetgraph/lib/transforms/moveAssets.js:10:7)
at Immediate._onImmediate (/Users/rusty/Development/assetgraph/lib/AssetGraph.js:653:25)
This is because this code in addAsset() is called:
To be fair, unencoded emojis are invalid per https://tools.ietf.org/html/rfc3986 as they aren't ascii. But it would probably be good to try to be as forgiving as browsers are.
Hi Team,
Assume you have an HTML file that is UTF-8 encoded, and there is an emoji included in an
href
attribute of the<a>
tag. The emoji is not escaped or anything else it is just a properly formed UTF-8 glyph. Such as:When attempting to move that asset this error is thrown:
This is because this code in
addAsset()
is called:That code mangles the nicely formed emoji character.
Rusty
The text was updated successfully, but these errors were encountered: