Skip to content

Commit 35ce9bf

Browse files
committed
use getFileStreamAndMetadata for attachments
1 parent a4f63bd commit 35ce9bf

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

components/microsoft_outlook/microsoft_outlook.app.mjs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import {
2-
axios, getFileStream,
2+
axios, getFileStreamAndMetadata,
33
} from "@pipedream/platform";
4-
import path from "path";
5-
import mime from "mime-types";
64
const DEFAULT_LIMIT = 50;
75

86
export default {
@@ -297,15 +295,17 @@ export default {
297295

298296
const attachments = [];
299297
for (let i = 0; self.files && i < self.files.length; i++) {
300-
const stream = await getFileStream(self.files[i]);
298+
const {
299+
stream, metadata,
300+
} = await getFileStreamAndMetadata(self.files[i]);
301301
const base64 = await this.streamToBase64(stream);
302302
attachments.push({
303303
"@odata.type": "#microsoft.graph.fileAttachment",
304-
"name": path.basename(self.files[i]),
305-
"contentType": mime.lookup(self.files[i]),
304+
"name": metadata.name,
305+
"contentType": metadata.contentType,
306306
"contentBytes": base64,
307307
});
308-
}
308+
} console.log(attachments);
309309
const message = {
310310
subject: self.subject,
311311
attachments,

0 commit comments

Comments
 (0)