File tree Expand file tree Collapse file tree 2 files changed +25
-18
lines changed Expand file tree Collapse file tree 2 files changed +25
-18
lines changed Original file line number Diff line number Diff line change @@ -322,12 +322,29 @@ export class Drive implements Contents.IDrive {
322322 if ( options . type !== undefined ) {
323323 // get incremented untitled name
324324 const name = this . incrementUntitledName ( old_data , options ) ;
325- data = await createObject ( currentDrive . name , {
325+ const currentPath = relativePath
326+ ? PathExt . join ( relativePath , name )
327+ : name ;
328+
329+ const result = await createObject ( currentDrive . name , {
326330 name : name ,
327- path : relativePath ,
331+ path : currentPath ,
328332 type : options . type ,
329333 registeredFileTypes : this . _registeredFileTypes
330334 } ) ;
335+
336+ data = {
337+ name : name ,
338+ path : PathExt . join ( currentDrive . name , currentPath ) ,
339+ last_modified : result . response . data . last_modified ,
340+ created : result . response . data . last_modified ,
341+ content : result . response . data . content ,
342+ format : result . fileFormat ,
343+ mimetype : result . fileMimeType ,
344+ size : result . response . data . size ,
345+ writable : true ,
346+ type : result . fileType
347+ } ;
331348 } else {
332349 console . warn ( 'Type of new element is undefined' ) ;
333350 }
Original file line number Diff line number Diff line change @@ -245,11 +245,8 @@ export async function createObject(
245245 registeredFileTypes : IRegisteredFileTypes ;
246246 }
247247) {
248- const path = options . path
249- ? PathExt . join ( options . path , options . name )
250- : options . name ;
251248 const response = await requestAPI < any > (
252- 'drives/' + driveName + '/' + path ,
249+ 'drives/' + driveName + '/' + options . path ,
253250 'POST' ,
254251 {
255252 type : options . type
@@ -261,19 +258,12 @@ export async function createObject(
261258 options . registeredFileTypes
262259 ) ;
263260
264- data = {
265- name : options . name ,
266- path : PathExt . join ( driveName , path ) ,
267- last_modified : response . data . last_modified ,
268- created : response . data . last_modified ,
269- content : response . data . content ,
270- format : fileFormat as Contents . FileFormat ,
271- mimetype : fileMimeType ,
272- size : response . data . size ,
273- writable : true ,
274- type : fileType
261+ return {
262+ response : response ,
263+ fileType : fileType ,
264+ fileMimeType : fileMimeType ,
265+ fileFormat : fileFormat as Contents . FileFormat
275266 } ;
276- return data ;
277267}
278268
279269/**
You can’t perform that action at this time.
0 commit comments