File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -17,18 +17,25 @@ const defaultOptions = {
17
17
removeFingerprintOnSuccess : true ,
18
18
fingerprint ( file , options = { } ) {
19
19
const attributes = [ file . name , file . type , file . size , file . lastModified ] ;
20
+ let attributesKey = 'tus-' ;
21
+ for ( let i = 0 ; i < attributes . length ; i ++ ) {
22
+ if ( attributes [ i ] ) {
23
+ attributesKey += `${ attributes [ i ] } -` ;
24
+ }
25
+ }
20
26
21
- const key = [ 'tus' , ...attributes ] . join ( '-' ) ;
22
-
27
+ const keys = Object . keys ( options . metadata || { } ) . map (
28
+ key => options . metadata [ key ]
29
+ ) ;
23
30
const signature = [
24
- ... attributes ,
31
+ attributes . toString ( ) . replace ( / , / g , '' ) ,
25
32
options . endpoint ,
26
- ... Object . keys ( options . metadata || { } ) . map ( key => options . metadata [ key ] ) ,
33
+ keys ,
27
34
] . join ( '' ) ;
28
35
29
36
const print = Math . abs ( hashCode ( signature ) ) ;
30
37
31
- return `${ key } ${ print } ` ;
38
+ return `${ attributesKey } ${ print } ` ;
32
39
} ,
33
40
} ;
34
41
You can’t perform that action at this time.
0 commit comments