Skip to content

Commit 1b5c444

Browse files
committed
Merge branch '16977-applying-fileurl-paths-improvement' into 16977-part-2
2 parents c30b8b9 + 648cc42 commit 1b5c444

File tree

3 files changed

+23
-25
lines changed

3 files changed

+23
-25
lines changed

components/pdf4me/actions/convert-to-pdf/convert-to-pdf.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,14 @@ export default {
2323
},
2424
},
2525
async run({ $ }) {
26+
const filename = utils.checkForExtension(this.filename, "pdf");
2627
const fileContent = await utils.getBase64File(this.filePath);
2728

2829
const response = await this.pdf4me.convertToPdf({
2930
$,
3031
data: {
3132
docContent: fileContent,
32-
docName: this.filename,
33+
docName: filename,
3334
},
3435
responseType: "arraybuffer",
3536
});

components/zoho_desk/actions/add-ticket-attachment/add-ticket-attachment.mjs

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import zohoDesk from "../../zoho_desk.app.mjs";
2-
import constants from "../../common/constants.mjs";
2+
import { getFileStreamAndMetadata } from "@pipedream/platform";
3+
import FormData from "form-data";
34

45
export default {
56
key: "zoho_desk-add-ticket-attachment",
@@ -44,19 +45,30 @@ export default {
4445
file,
4546
} = this;
4647

48+
const data = new FormData();
49+
const {
50+
stream, metadata,
51+
} = await getFileStreamAndMetadata(file);
52+
data.append("file", stream, {
53+
contentType: metadata.contentType,
54+
knownLength: metadata.size,
55+
filename: metadata.name,
56+
});
57+
4758
const response = await this.zohoDesk.createTicketAttachment({
59+
$,
4860
ticketId,
61+
params: {
62+
isPublic,
63+
},
4964
headers: {
5065
orgId,
51-
...constants.MULTIPART_FORM_DATA_HEADERS,
52-
},
53-
data: {
54-
file,
55-
isPublic,
66+
...data.getHeaders(),
5667
},
68+
data,
5769
});
5870

59-
$.export("$summary", `Successfully created a new ticket attachment with ID ${response.id}`);
71+
$.export("$summary", `Successfully created a new ticket attachment with ID ${response?.id}`);
6072

6173
return response;
6274
},

components/zoho_desk/zoho_desk.app.mjs

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -124,31 +124,16 @@ export default {
124124
$ = this,
125125
url,
126126
path,
127-
headers: preHeaders,
128127
params,
129-
data: preData,
128+
headers,
130129
versionPath = constants.VERSION_PATH,
131130
withRetries = true,
132131
...args
133132
} = {}) {
134-
const contentType = constants.CONTENT_TYPE_KEY_HEADER;
135-
136-
const hasMultipartHeader = utils.hasMultipartHeader(preHeaders);
137-
const data = hasMultipartHeader && await utils.getFormData(preData) || preData;
138-
139-
const currentHeaders = this.getHeaders(preHeaders);
140-
const headers = hasMultipartHeader
141-
? {
142-
...currentHeaders,
143-
[contentType]: data.getHeaders()[contentType.toLowerCase()],
144-
}
145-
: currentHeaders;
146-
147133
const config = {
148-
headers,
149134
url: this.getUrl(url, path, versionPath),
150135
params: this.getParams(url, params),
151-
data,
136+
headers: this.getHeaders(headers),
152137
...args,
153138
};
154139
try {

0 commit comments

Comments
 (0)