Skip to content

Commit c582798

Browse files
authored
Merge pull request #832 from OpenSPP/dms-fixes
[IMP] preview of images
2 parents 77a7b0c + 5f8733e commit c582798

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

spp_dms/static/src/js/preview_binary_field.esm.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,16 @@ export class PreviewRecordWidget extends Component {
3939
if (record.mimetype === "application/pdf") {
4040
window.open(fileUrl, "_blank");
4141
} else {
42-
const attachment = this.store.Attachment.insert({
43-
id: resId,
44-
filename: record.name || "",
45-
name: record.name || "",
46-
mimetype: record.mimetype,
47-
model_name: resModel,
48-
url: fileUrl,
49-
});
42+
const fileModel = {
43+
isImage: Boolean(record.mimetype.startsWith("image/")),
44+
isVideo: Boolean(record.mimetype.startsWith("video/")),
45+
isViewable: true,
46+
displayName: record.name,
47+
defaultSource: fileUrl,
48+
downloadUrl: fileUrl,
49+
};
5050

51-
this.fileViewer.open(attachment);
51+
this.fileViewer.open(fileModel);
5252
}
5353
}
5454
}

0 commit comments

Comments
 (0)