(core) Fix reporting of blank attachment types

Summary:
The conditions in the map/filter of attachments was faulty, causing
blank attachment types to slip through.

Test Plan: Tested manually.

Reviewers: jarek

Reviewed By: jarek

Differential Revision: https://phab.getgrist.com/D3865
pull/503/head
George Gevoian 1 year ago
parent b15ae98349
commit c077f3c304

@ -2326,8 +2326,9 @@ export class ActiveDoc extends EventEmitter {
const attachments = this.docData?.getMetaTable('_grist_Attachments');
const numAttachments = attachments?.numRecords() ?? 0;
const attachmentTypes = attachments?.getRecords()
.map(r => r.fileExt?.slice(1) ?? null)
.filter(ext => ext !== null);
// Exclude the leading ".", if any.
.map(r => r.fileExt?.trim()?.slice(1))
.filter(ext => Boolean(ext));
return {
numAttachments,

Loading…
Cancel
Save