Skip to content

Commit

Permalink
prevent errors if now mimetypes
Browse files Browse the repository at this point in the history
  • Loading branch information
elizavetaRa committed Nov 10, 2021
1 parent 27b33e2 commit 0b507fd
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions packages/web-app-files/src/components/AppBar/AppBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -94,19 +94,23 @@
</oc-button>
</div>
</li>
<li v-for="(mimetype, key) in mimetypesAllowedForCreation" :key="key">
<div>
<oc-button
appearance="raw"
justify-content="left"
:class="['uk-width-1-1']"
@click="showCreateResourceModal(false, mimetype.ext, false, true)"
>
<oc-icon :name="mimetype.icon || 'file'" />
<translate :translate-params="{ name: mimetype.name }">New %{name}</translate>
</oc-button>
</div>
</li>
<template v-if="getMimeTypes">
<li v-for="(mimetype, key) in mimetypesAllowedForCreation" :key="key">
<div>
<oc-button
appearance="raw"
justify-content="left"
:class="['uk-width-1-1']"
@click="showCreateResourceModal(false, mimetype.ext, false, true)"
>
<oc-icon :name="mimetype.icon || 'file'" />
<translate :translate-params="{ name: mimetype.name }"
>New %{name}</translate
>
</oc-button>
</div>
</li>
</template>
</ul>
</oc-drop>
</template>
Expand Down Expand Up @@ -165,7 +169,7 @@ export default {
...mapState('Files', ['areHiddenFilesShown']),
mimetypesAllowedForCreation() {
return this.getMimeTypes.filter((mimetype) => mimetype.allow_creation)
return this.getMimeTypes.filter((mimetype) => mimetype.allow_creation) || []
},
newButtonTooltip() {
if (!this.canUpload) {
Expand Down Expand Up @@ -300,7 +304,6 @@ export default {
}
},
methods: {
...mapGetters('External', ['getMimeTypes']),
...mapActions('Files', [
'updateFileProgress',
'removeFilesFromTrashbin',
Expand Down

0 comments on commit 0b507fd

Please sign in to comment.