File tree Expand file tree Collapse file tree 1 file changed +3
-8
lines changed Expand file tree Collapse file tree 1 file changed +3
-8
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ export type FileSource = {
24
24
} ;
25
25
26
26
var dataUriRegexp =
27
- / ^ d a t a : ( [ a - z A - Z ] * \/ [ a - z A - Z + . - ] * ) ; ( c h a r s e t = [ a - z A - Z 0 - 9 \- \/ \s ] * , ) ? b a s e 6 4 , ( \S + ) / ;
27
+ / ^ d a t a : ( [ a - z A - Z ] * \/ [ a - z A - Z + . - ] * ) ; ( c h a r s e t = [ a - z A - Z 0 - 9 \- \/ \s ] * , ) ? b a s e 6 4 , / ;
28
28
29
29
function b64Digit ( number : number ) : string {
30
30
if ( number < 26 ) {
@@ -99,15 +99,10 @@ export default class ParseFile {
99
99
type : specifiedType
100
100
} ;
101
101
} else if ( data && data . hasOwnProperty ( 'base64' ) ) {
102
- var commaIndex = data . base64 . indexOf ( ',' ) ;
103
- try {
104
- window . atob ( commaIndex === - 1 ?data . base64 :data . base64 . slice ( commaIndex + 1 ) ) ;
105
- } catch ( e ) {
106
- throw new TypeError ( 'Cannot create a Parse.File with that data.' ) ;
107
- }
102
+ var commaIndex = data . base64 . indexOf ( ',' ) ;
108
103
109
104
if ( commaIndex !== - 1 ) {
110
- var matches = dataUriRegexp . exec ( data . base64 . slice ( 0 , 100 ) ) ;
105
+ var matches = dataUriRegexp . exec ( data . base64 . slice ( 0 , commaIndex + 1 ) ) ;
111
106
// if data URI with type and charset, there will be 4 matches.
112
107
this . _source = {
113
108
format : 'base64' ,
You can’t perform that action at this time.
0 commit comments