Skip to content

Commit

Permalink
Fix seed when image is not specified.
Browse files Browse the repository at this point in the history
  • Loading branch information
robgietema committed May 19, 2023
1 parent 8188df1 commit fffe85c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -34,6 +34,7 @@
- Fix exclude from nav in navigation call @robgietema
- Index documents after all documents have been seeded @robgietema
- Fix get title handler @robgietema
- Fix seeds when image is not provided @robgietema

### Internal

Expand Down
2 changes: 1 addition & 1 deletion src/helpers/content/content.js
Expand Up @@ -89,7 +89,7 @@ export async function handleImages(json, type, profile) {
}

// Check if new data is uploaded
if ('data' in fields[field]) {
if (fields[field] && 'data' in fields[field]) {
// Create filestream
const { uuid, size, width, height, scales } = await writeImage(
fields[field].data,
Expand Down
4 changes: 2 additions & 2 deletions src/models/document/document.js
Expand Up @@ -686,11 +686,11 @@ export class Document extends Model {
mimeType() {
const imageFields = this._type.getFactoryFields('Image');
if (imageFields.length > 0) {
return this.json[imageFields[0]]['content-type'];
return this.json[imageFields[0]]?.['content-type'];
}
const fileFields = this._type.getFactoryFields('File');
if (fileFields.length > 0) {
return this.json[fileFields[0]]['content-type'];
return this.json[fileFields[0]]?.['content-type'];
}
return undefined;
}
Expand Down

0 comments on commit fffe85c

Please sign in to comment.