PR comments.
This commit is contained in:
parent
5b5e7e47a2
commit
39147b80b6
2 changed files with 8 additions and 2 deletions
|
@ -70,6 +70,9 @@ async function processUrlAttachment(
|
|||
throw new Error(`Unexpected response ${response.statusText}`)
|
||||
}
|
||||
const fallbackFilename = path.basename(new URL(attachment.url).pathname)
|
||||
if (!response.body) {
|
||||
throw new Error("No response received for attachment")
|
||||
}
|
||||
return {
|
||||
filename: attachment.filename || fallbackFilename,
|
||||
content: stream.Readable.fromWeb(response.body as streamWeb.ReadableStream),
|
||||
|
|
|
@ -163,7 +163,10 @@ async function generateAttachmentRow(attachment: AutomationAttachment) {
|
|||
|
||||
try {
|
||||
const { filename } = attachment
|
||||
const extension = path.extname(filename).replaceAll(".", "")
|
||||
let extension = path.extname(filename)
|
||||
if (extension.startsWith(".")) {
|
||||
extension = extension.substring(1, extension.length)
|
||||
}
|
||||
const attachmentResult = await objectStore.processAutomationAttachment(
|
||||
attachment
|
||||
)
|
||||
|
@ -182,8 +185,8 @@ async function generateAttachmentRow(attachment: AutomationAttachment) {
|
|||
|
||||
return {
|
||||
size,
|
||||
extension,
|
||||
name: filename,
|
||||
extension: extension,
|
||||
key: s3Key,
|
||||
}
|
||||
} catch (error) {
|
||||
|
|
Loading…
Reference in a new issue