diff --git a/functions/utils/contenttypes.js b/functions/utils/contenttypes.js index 4e9173cee..d9f1d8177 100644 --- a/functions/utils/contenttypes.js +++ b/functions/utils/contenttypes.js @@ -9,9 +9,19 @@ export const knownContentTypes = [ ] export function isJSONContentType(contentType) { - return ( - contentType === "application/json" || - contentType === "application/vnd.api+json" || - contentType === "application/hal+json" - ) + if (contentType.includes(";")) { + const [justContentType] = contentType.split(";") + + return ( + justContentType === "application/json" || + justContentType === "application/vnd.api+json" || + justContentType === "application/hal+json" + ) + } else { + return ( + contentType === "application/json" || + contentType === "application/vnd.api+json" || + contentType === "application/hal+json" + ) + } } diff --git a/pages/index.vue b/pages/index.vue index 62d2769d6..1a0ae504e 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -973,7 +973,7 @@ class="icon" @click="downloadResponse" ref="downloadResponse" - v-if="response.body" + v-if="response.body && canDownloadResponse" v-tooltip="$t('download_file')" > get_app @@ -1612,6 +1612,14 @@ export default { isJSONContentType(this.contentType) ) }, + canDownloadResponse() { + return ( + this.response && + this.response.headers && + this.response.headers["content-type"] && + isJSONContentType(this.response.headers["content-type"]) + ) + }, uri: { get() { return this.$store.state.request.uri ? this.$store.state.request.uri : this.url + this.path