Skip to content

Commit 8f711de

Browse files
authored
Merge pull request #5440 from akolson/fix-undefined-file_format
Adds defensive check when reading file_format on file object
2 parents aeb632b + 9570b96 commit 8f711de

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

contentcuration/contentcuration/frontend/channelEdit/views/files/ContentRenderer.vue

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -201,27 +201,30 @@
201201
f => f.language.id,
202202
);
203203
},
204+
fileFormat() {
205+
return this.file?.file_format || '';
206+
},
204207
isVideo() {
205-
return this.file.file_format === 'mp4' || this.file.file_format === 'webm';
208+
return this.fileFormat === 'mp4' || this.fileFormat === 'webm';
206209
},
207210
isAudio() {
208-
return this.file.file_format === 'mp3';
211+
return this.fileFormat === 'mp3';
209212
},
210213
isHTML() {
211-
return this.file.file_format === 'zip';
214+
return this.fileFormat === 'zip';
212215
},
213216
isPDF() {
214-
return this.file.file_format === 'pdf';
217+
return this.fileFormat === 'pdf';
215218
},
216219
isEpub() {
217-
return this.file.file_format === 'epub';
220+
return this.fileFormat === 'epub';
218221
},
219222
isSupported() {
220223
return this.isVideo || this.isAudio || this.isHTML || this.isPDF || this.isEpub;
221224
},
222225
htmlPath() {
223226
const entry = get(this.contentNode, ['extra_fields', 'options', 'entry'], 'index.html');
224-
return `/zipcontent/${this.file.checksum}.${this.file.file_format}/${entry}`;
227+
return `/zipcontent/${this.file.checksum}.${this.fileFormat}/${entry}`;
225228
},
226229
src() {
227230
return this.file && this.file.url;

0 commit comments

Comments
 (0)