We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ab84045 commit 3aff167Copy full SHA for 3aff167
turbopack/crates/turbopack-ecmascript/src/source_map.rs
@@ -38,11 +38,16 @@ impl GenerateSourceMap for InlineSourceMap {
38
39
fn maybe_decode_data_url(url: &str) -> Option<Rope> {
40
const DATA_PREAMBLE: &str = "data:application/json;base64,";
41
+ const DATA_PREAMBLE_CHARSET: &str = "data:application/json;charset=utf-8;base64,";
42
- if !url.starts_with(DATA_PREAMBLE) {
43
+ let data_b64 = if let Some(data) = url.strip_prefix(DATA_PREAMBLE) {
44
+ data
45
+ } else if let Some(data) = url.strip_prefix(DATA_PREAMBLE_CHARSET) {
46
47
+ } else {
48
return None;
- }
- let data_b64 = &url[DATA_PREAMBLE.len()..];
49
+ };
50
+
51
data_encoding::BASE64
52
.decode(data_b64.as_bytes())
53
.ok()
0 commit comments