File tree Expand file tree Collapse file tree 2 files changed +6
-14
lines changed
components/microsoft_onedrive Expand file tree Collapse file tree 2 files changed +6
-14
lines changed Original file line number Diff line number Diff line change 11import onedrive from "../../microsoft_onedrive.app.mjs" ;
22import {
3- ConfigurationError , getFileStream ,
3+ ConfigurationError ,
4+ getFileStreamAndMetadata ,
45} from "@pipedream/platform" ;
5- import { fileTypeFromStream } from "file-type" ;
66
77export default {
88 name : "Upload File" ,
@@ -40,17 +40,10 @@ export default {
4040 throw new ConfigurationError ( "You must specify the **Upload Folder ID**." ) ;
4141 }
4242
43- let stream = await getFileStream ( filePath ) ;
44- let name = filename ;
45-
46- if ( ! filename . includes ( "." ) ) {
47- const fileTypeResult = await fileTypeFromStream ( stream ) ;
48- const extension = fileTypeResult ?. ext || "" ;
49- name = `${ filename } .${ extension } ` ;
50-
51- stream . destroy ( ) ;
52- stream = await getFileStream ( filePath ) ;
53- }
43+ const {
44+ stream, metadata,
45+ } = await getFileStreamAndMetadata ( filePath ) ;
46+ const name = filename || metadata . name ;
5447
5548 const response = await this . onedrive . uploadFile ( {
5649 uploadFolderId,
Original file line number Diff line number Diff line change 1212 "@microsoft/microsoft-graph-client" : " ^3.0.1" ,
1313 "@pipedream/platform" : " ^3.1.0" ,
1414 "bottleneck" : " ^2.19.5" ,
15- "file-type" : " ^18.7.0" ,
1615 "isomorphic-fetch" : " ^3.0.0" ,
1716 "lodash.get" : " ^4.4.2"
1817 }
You can’t perform that action at this time.
0 commit comments