File tree 2 files changed +15
-3
lines changed
2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -37,9 +37,10 @@ export default class PreviousMap {
37
37
}
38
38
39
39
decodeInline ( text ) {
40
- let utf64 = 'data:application/json;charset=utf-8;base64,' ;
41
- let b64 = 'data:application/json;base64,' ;
42
- let uri = 'data:application/json,' ;
40
+ let utfd64 = 'data:application/json;charset=utf-8;base64,' ;
41
+ let utf64 = 'data:application/json;charset=utf8;base64,' ;
42
+ let b64 = 'data:application/json;base64,' ;
43
+ let uri = 'data:application/json,' ;
43
44
44
45
if ( this . startWith ( text , uri ) ) {
45
46
return decodeURIComponent ( text . substr ( uri . length ) ) ;
@@ -50,6 +51,9 @@ export default class PreviousMap {
50
51
} else if ( this . startWith ( text , utf64 ) ) {
51
52
return Base64 . decode ( text . substr ( utf64 . length ) ) ;
52
53
54
+ } else if ( this . startWith ( text , utfd64 ) ) {
55
+ return Base64 . decode ( text . substr ( utfd64 . length ) ) ;
56
+
53
57
} else {
54
58
let encoding = text . match ( / d a t a : a p p l i c a t i o n \/ j s o n ; ( [ ^ , ] + ) , / ) [ 1 ] ;
55
59
throw new Error ( 'Unsupported source map encoding ' + encoding ) ;
Original file line number Diff line number Diff line change @@ -76,6 +76,14 @@ describe('PreviousMap', () => {
76
76
expect ( parse ( css ) . source . input . map . text ) . to . eql ( map ) ;
77
77
} ) ;
78
78
79
+ it ( 'accepts different name for UTF-8 encoding' , ( ) => {
80
+ let b64 = new Buffer ( map ) . toString ( 'base64' ) ;
81
+ let css = 'a{}\n/*# sourceMappingURL=data:application/json;' +
82
+ 'charset=utf8;base64,' + b64 + ' */' ;
83
+
84
+ expect ( parse ( css ) . source . input . map . text ) . to . eql ( map ) ;
85
+ } ) ;
86
+
79
87
it ( 'decodes URI maps' , ( ) => {
80
88
let uri = 'data:application/json,' + decodeURI ( map ) ;
81
89
let css = `a{}\n/*# sourceMappingURL=${ uri } */` ;
You can’t perform that action at this time.
0 commit comments