Skip to content

Commit 094bf97

Browse files
committed
Onedrive adjustment
1 parent 69bbb92 commit 094bf97

File tree

2 files changed

+6
-14
lines changed

2 files changed

+6
-14
lines changed

components/microsoft_onedrive/actions/upload-file/upload-file.mjs

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import onedrive from "../../microsoft_onedrive.app.mjs";
22
import {
3-
ConfigurationError, getFileStream,
3+
ConfigurationError,
4+
getFileStreamAndMetadata,
45
} from "@pipedream/platform";
5-
import { fileTypeFromStream } from "file-type";
66

77
export 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,

components/microsoft_onedrive/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
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
}

0 commit comments

Comments
 (0)