Skip to content

Commit 0f93e0c

Browse files
author
Bjornskjald
committed
Fixed errors on unavailable attachments
1 parent 693a933 commit 0f93e0c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/types/attachments/parseXMAAttachment.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ import {
99
import { parse } from 'url'
1010
import vm from 'vm'
1111

12-
export default function parseXMAAttachment (attach: any) {
13-
attach = attach[Object.keys(attach)[0]].story_attachment
12+
export default function parseXMAAttachment (xma: any) {
13+
const attach = xma[Object.keys(xma)[0]].story_attachment
1414
if (!attach.target || !attach.target.__type__) {
1515
return {
1616
type: 'UnavailableXMA',
17-
message: attach.description.text,
18-
attach
17+
message: attach.description ? attach.description.text : 'Attachment unavailable',
18+
attach: xma
1919
} as UnavailableXMA
2020
}
2121
const type = attach.target.__type__.name

0 commit comments

Comments
 (0)