attachment: fix over reliance on fileType()

Signed-off-by: Yonle <yonle@proton.me>
This commit is contained in:
Yonle 2026-02-27 04:12:47 +07:00
commit 38444f3165
No known key found for this signature in database
GPG key ID: 11889F326F523287
10 changed files with 41 additions and 63 deletions

View file

@ -1,5 +1,6 @@
import { parseLinkHeader } from '@web3-storage/parse-link-header'
import escapeHtml from 'escape-html'
import fileTypeService from '../file_type/file_type.service.js'
import punycode from 'punycode.js'
import { isStatusNotification } from '../notification_utils/notification_utils.js'
@ -297,6 +298,11 @@ export const parseAttachment = (data) => {
// output.meta = ??? missing
}
if (data.type !== 'unknown') {
output.type = data.type
} else {
output.type = fileTypeService.fileType(output.mimetype)
}
output.url = data.url
output.large_thumb_url = data.preview_url
output.description = data.description