Skip to content

Commit

Permalink
fix(@ngtools/webpack): encode component style data
Browse files Browse the repository at this point in the history
We now encode the data using `encodeURIComponent` which safely encodes `+` signs. Without this a portion of the buffer was lost and caused `Unrecognised input` errors.

Closes #21236
  • Loading branch information
alan-agius4 committed Jun 30, 2021
1 parent 398f56d commit 6a7bcf3
Showing 1 changed file with 3 additions and 1 deletion.
Expand Up @@ -208,7 +208,9 @@ function visitComponentMetadata(
} else if (inlineStyleFileExtension) {
const data = Buffer.from(node.text).toString('base64');
const containingFile = node.getSourceFile().fileName;
url = `${containingFile}.${inlineStyleFileExtension}!=!${inlineDataLoaderPath}?data=${data}!${containingFile}`;
url = `${containingFile}.${inlineStyleFileExtension}!=!${inlineDataLoaderPath}?data=${encodeURIComponent(
data,
)}!${containingFile}`;
} else {
return nodeFactory.createStringLiteral(node.text);
}
Expand Down

0 comments on commit 6a7bcf3

Please sign in to comment.