diff --git a/packages/cli/src/Server.ts b/packages/cli/src/Server.ts index fab952e0f..65217120d 100644 --- a/packages/cli/src/Server.ts +++ b/packages/cli/src/Server.ts @@ -1515,7 +1515,9 @@ class App { identifier, ); if (mimeType) res.setHeader('Content-Type', mimeType); - if (fileName) res.setHeader('Content-Disposition', `attachment; filename="${fileName}"`); + if (req.query.mode === 'download' && fileName) { + res.setHeader('Content-Disposition', `attachment; filename="${fileName}"`); + } res.setHeader('Content-Length', fileSize); res.sendFile(binaryPath); }, diff --git a/packages/editor-ui/src/Interface.ts b/packages/editor-ui/src/Interface.ts index eb5f7fb7d..51eb5b6cc 100644 --- a/packages/editor-ui/src/Interface.ts +++ b/packages/editor-ui/src/Interface.ts @@ -235,8 +235,7 @@ export interface IRestApi { deleteExecutions(sendData: IExecutionDeleteFilter): Promise; retryExecution(id: string, loadWorkflow?: boolean): Promise; getTimezones(): Promise; - getBinaryBufferString(dataPath: string): Promise; - getBinaryUrl(dataPath: string): string; + getBinaryUrl(dataPath: string, mode: 'view' | 'download'): string; } export interface INodeTranslationHeaders { diff --git a/packages/editor-ui/src/components/BinaryDataDisplay.vue b/packages/editor-ui/src/components/BinaryDataDisplay.vue index f1d35b035..c1f5b7135 100644 --- a/packages/editor-ui/src/components/BinaryDataDisplay.vue +++ b/packages/editor-ui/src/components/BinaryDataDisplay.vue @@ -111,19 +111,5 @@ export default mixins(nodeHelpers, restApi).extend({ height: 100%; } } - - .binary-data { - background-color: var(--color-foreground-xlight); - - &.image { - max-height: calc(100% - 1em); - max-width: calc(100% - 1em); - } - - &.other { - height: calc(100% - 1em); - width: calc(100% - 1em); - } - } } diff --git a/packages/editor-ui/src/components/BinaryDataDisplayEmbed.vue b/packages/editor-ui/src/components/BinaryDataDisplayEmbed.vue index 5b71d0a48..a0ce6d7de 100644 --- a/packages/editor-ui/src/components/BinaryDataDisplayEmbed.vue +++ b/packages/editor-ui/src/components/BinaryDataDisplayEmbed.vue @@ -56,7 +56,7 @@ export default mixins(restApi).extend({ } } else { try { - const binaryUrl = this.restApi().getBinaryUrl(id); + const binaryUrl = this.restApi().getBinaryUrl(id, 'view'); if (isJSONData) { this.jsonData = await (await fetch(binaryUrl)).json(); } else { diff --git a/packages/editor-ui/src/components/RunData.vue b/packages/editor-ui/src/components/RunData.vue index 0671518e9..a9f310e98 100644 --- a/packages/editor-ui/src/components/RunData.vue +++ b/packages/editor-ui/src/components/RunData.vue @@ -1202,7 +1202,7 @@ export default mixins(externalHooks, genericHelpers, nodeHelpers, pinData).exten const { id, data, fileName, fileExtension, mimeType } = this.binaryData[index][key]; if (id) { - const url = this.restApi().getBinaryUrl(id); + const url = this.restApi().getBinaryUrl(id, 'download'); saveAs(url, [fileName, fileExtension].join('.')); return; } else { diff --git a/packages/editor-ui/src/mixins/restApi.ts b/packages/editor-ui/src/mixins/restApi.ts index eeda2ccf9..b9bbbcc64 100644 --- a/packages/editor-ui/src/mixins/restApi.ts +++ b/packages/editor-ui/src/mixins/restApi.ts @@ -201,13 +201,8 @@ export const restApi = Vue.extend({ }, // Binary data - getBinaryBufferString: (dataPath: string): Promise => { - return self.restApi().makeRestApiRequest('GET', `/data/${dataPath}`); - }, - - getBinaryUrl: (dataPath: string): string => { - return self.rootStore.getRestApiContext.baseUrl + `/data/${dataPath}`; - }, + getBinaryUrl: (dataPath, mode): string => + self.rootStore.getRestApiContext.baseUrl + `/data/${dataPath}?mode=${mode}`, }; }, },