fix: embed links #390 (#403)

* fix: Use raw route for embedding images.

* fix: there was already a raw link passed 😔
This commit is contained in:
Jayvin Hernandez 2023-05-12 23:14:59 -07:00 committed by GitHub
parent 1ddd351242
commit a7ad58b196
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View file

@ -63,13 +63,13 @@ export async function sendUpload(user: User, file: File, raw_link: string, link:
thumbnail:
isImage && parsed.embed.thumbnail
? {
url: parsed.url,
url: raw_link,
}
: null,
image:
isImage && parsed.embed.image
? {
url: parsed.url,
url: raw_link,
}
: null,
},

View file

@ -255,7 +255,12 @@ async function handler(req: NextApiReq, res: NextApiRes) {
response.files.push(responseUrl);
if (zconfig.discord?.upload) {
await sendUpload(user, fileUpload, `${domain}/r/${invis ? invis.invis : fileUpload.name}`, responseUrl);
await sendUpload(
user,
fileUpload,
`${domain}/r/${invis ? invis.invis : encodeURI(fileUpload.name)}`,
responseUrl
);
}
if (zconfig.exif.enabled && zconfig.exif.remove_gps && fileUpload.mimetype.startsWith('image/')) {