File tree 2 files changed +14
-2
lines changed
2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ export type FileSource =
43
43
} ;
44
44
45
45
const base64Regex = new RegExp (
46
- '([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}== )|([0-9a-zA-Z+/]{3}= ))' ,
46
+ '([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/][AQgw]==)|([0-9a-zA-Z+/] {2}[AEIMQUYcgkosw048]= )|([0-9a-zA-Z+/]{4} ))' ,
47
47
'i'
48
48
) ;
49
49
Original file line number Diff line number Diff line change @@ -60,7 +60,19 @@ describe('ParseFile', () => {
60
60
process . env . PARSE_BUILD = 'node' ;
61
61
} ) ;
62
62
63
- it ( 'can create files with base64 encoding' , ( ) => {
63
+ it ( 'can create files with base64 encoding (no padding)' , ( ) => {
64
+ const file = new ParseFile ( 'parse.txt' , { base64 : 'YWJj' } ) ;
65
+ expect ( file . _source . base64 ) . toBe ( 'YWJj' ) ;
66
+ expect ( file . _source . type ) . toBe ( '' ) ;
67
+ } ) ;
68
+
69
+ it ( 'can create files with base64 encoding (1 padding)' , ( ) => {
70
+ const file = new ParseFile ( 'parse.txt' , { base64 : 'YWI=' } ) ;
71
+ expect ( file . _source . base64 ) . toBe ( 'YWI=' ) ;
72
+ expect ( file . _source . type ) . toBe ( '' ) ;
73
+ } ) ;
74
+
75
+ it ( 'can create files with base64 encoding (2 padding)' , ( ) => {
64
76
const file = new ParseFile ( 'parse.txt' , { base64 : 'ParseA==' } ) ;
65
77
expect ( file . _source . base64 ) . toBe ( 'ParseA==' ) ;
66
78
expect ( file . _source . type ) . toBe ( '' ) ;
You can’t perform that action at this time.
0 commit comments