File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -166,7 +166,21 @@ module.exports = class Tus extends Plugin {
166
166
this . resetUploaderReferences ( file . id )
167
167
resolve ( upload )
168
168
}
169
- optsTus . metadata = file . meta
169
+
170
+ const copyProp = ( obj , srcProp , destProp ) => {
171
+ if (
172
+ Object . prototype . hasOwnProperty . call ( obj , srcProp ) &&
173
+ ! Object . prototype . hasOwnProperty . call ( obj , destProp )
174
+ ) {
175
+ obj [ destProp ] = obj [ srcProp ]
176
+ }
177
+ }
178
+
179
+ // tusd uses metadata fields 'filetype' and 'filename'
180
+ const meta = Object . assign ( { } , file . meta )
181
+ copyProp ( meta , 'type' , 'filetype' )
182
+ copyProp ( meta , 'name' , 'filename' )
183
+ optsTus . metadata = meta
170
184
171
185
const upload = new tus . Upload ( file . data , optsTus )
172
186
this . uploaders [ file . id ] = upload
You can’t perform that action at this time.
0 commit comments