File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed
packages/gitbook/src/components/DocumentView/Table Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " gitbook " : patch
3
+ ---
4
+
5
+ Fix crash for card cover defined without objectFit
Original file line number Diff line number Diff line change @@ -71,16 +71,18 @@ function processCoverValue(value: DocumentTableImageRecord | string[] | null | u
71
71
}
72
72
}
73
73
74
+ const imageValue = value as DocumentTableImageRecord | null | undefined ;
75
+
74
76
// Check if it's the new schema with objectFit
75
- if ( value && typeof value === 'object' && 'ref' in value && 'objectFit' in value ) {
77
+ if ( imageValue && typeof imageValue === 'object' && 'ref' in imageValue ) {
76
78
return {
77
- contentRef : value . ref ,
78
- objectFit : value . objectFit ,
79
+ contentRef : imageValue . ref ,
80
+ objectFit : imageValue . objectFit ,
79
81
} ;
80
82
}
81
83
82
84
// It's a direct ContentRef
83
- return { contentRef : value as ContentRefFile | ContentRefURL } ;
85
+ return { contentRef : imageValue || null } ;
84
86
}
85
87
86
88
/**
You can’t perform that action at this time.
0 commit comments