mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-01 10:01:12 +01:00
fix: handling of href in remote object attachments, #13169
This commit is contained in:
@@ -39,11 +39,15 @@ Attachments.update = async (pid, attachments) => {
|
|||||||
hash: [],
|
hash: [],
|
||||||
};
|
};
|
||||||
const hashes = [];
|
const hashes = [];
|
||||||
attachments.filter(Boolean).forEach(({ _type, mediaType, url, name, width, height }) => {
|
attachments.filter(Boolean).forEach(({ _type, mediaType, href, url, name, width, height }) => {
|
||||||
if (!url) { // only required property
|
if (!url && !href) { // one or the other are required
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!url && href) {
|
||||||
|
url = href;
|
||||||
|
}
|
||||||
|
|
||||||
const hash = crypto.createHash('sha256').update(url).digest('hex');
|
const hash = crypto.createHash('sha256').update(url).digest('hex');
|
||||||
const key = `attachment:${hash}`;
|
const key = `attachment:${hash}`;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user