fedimbed: attempt to fallback media type when uploading
This commit is contained in:
parent
44779f7a23
commit
a5dfd6395a
1 changed files with 14 additions and 6 deletions
|
@ -465,7 +465,11 @@ async function processUrl(msg, url) {
|
||||||
.then((buf) => Buffer.from(buf));
|
.then((buf) => Buffer.from(buf));
|
||||||
|
|
||||||
files.push({
|
files.push({
|
||||||
name: attachment.type.replace("/", "."),
|
name:
|
||||||
|
attachment.type.indexOf("/") > -1
|
||||||
|
? attachment.type.replace("/", ".")
|
||||||
|
: attachment.type +
|
||||||
|
(url.match(/\.([a-z0-9]{3,4})$/)?.[0] ?? "mp4"),
|
||||||
contents: file,
|
contents: file,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -492,11 +496,15 @@ async function processUrl(msg, url) {
|
||||||
.then((buf) => Buffer.from(buf));
|
.then((buf) => Buffer.from(buf));
|
||||||
|
|
||||||
files.push({
|
files.push({
|
||||||
name: attachment.type
|
name:
|
||||||
.replace("/", ".")
|
attachment.type.indexOf("/") > -1
|
||||||
.replace("mpeg", "mp3")
|
? attachment.type
|
||||||
.replace("vnd.wave", "wav")
|
.replace("/", ".")
|
||||||
.replace("x-wav", "wav"),
|
.replace("mpeg", "mp3")
|
||||||
|
.replace("vnd.wave", "wav")
|
||||||
|
.replace("x-wav", "wav")
|
||||||
|
: attachment.type +
|
||||||
|
(url.match(/\.([a-z0-9]{3,4})$/)?.[0] ?? "mp3"),
|
||||||
contents: file,
|
contents: file,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue