fix(api): 🐛 Don't transform raw URLs as if they were attachments

This commit is contained in:
Jesse Wierzbinski 2024-12-09 12:43:53 +01:00
parent 8796f694bc
commit c94dd7c59d
No known key found for this signature in database
2 changed files with 4 additions and 4 deletions

View file

@ -306,13 +306,13 @@ export default apiRoute((app) => {
if (element instanceof File) { if (element instanceof File) {
const uploaded = await mediaManager.addFile(element); const uploaded = await mediaManager.addFile(element);
url = uploaded.path; url = Attachment.getUrl(uploaded.path);
contentType = uploaded.uploadedFile.type; contentType = uploaded.uploadedFile.type;
} else { } else {
url = element; url = element;
} }
modified.url = Attachment.getUrl(url); modified.url = url;
modified.contentType = contentType; modified.contentType = contentType;
} }

View file

@ -167,7 +167,7 @@ export default apiRoute((app) =>
const uploaded = await mediaManager.addFile(element); const uploaded = await mediaManager.addFile(element);
url = uploaded.path; url = Attachment.getUrl(uploaded.path);
contentType = uploaded.uploadedFile.type; contentType = uploaded.uploadedFile.type;
} else { } else {
url = element; url = element;
@ -175,7 +175,7 @@ export default apiRoute((app) =>
const emoji = await Emoji.insert({ const emoji = await Emoji.insert({
shortcode, shortcode,
url: Attachment.getUrl(url), url,
visibleInPicker: true, visibleInPicker: true,
ownerId: global ? null : user.id, ownerId: global ? null : user.id,
category, category,