From d17c6adba4cc683a74883b07933603c99e095554 Mon Sep 17 00:00:00 2001 From: MeiMei <30769358+mei23@users.noreply.github.com> Date: Fri, 4 Oct 2019 20:18:41 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=80=E3=82=A6=E3=83=B3=E3=83=AD=E3=83=BC?= =?UTF-8?q?=E3=83=89URL=E3=81=ABdownload=E3=82=92=E4=BB=98=E3=81=91?= =?UTF-8?q?=E3=81=AA=E3=81=84=E3=81=AA=E3=81=A9=20(#5488)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/client/app/desktop/views/components/drive.file.vue | 4 ++-- src/client/app/mobile/views/components/drive.file-detail.vue | 3 +-- src/server/file/send-drive-file.ts | 4 +--- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/client/app/desktop/views/components/drive.file.vue b/src/client/app/desktop/views/components/drive.file.vue index efc534ee7..e34fdff42 100644 --- a/src/client/app/desktop/views/components/drive.file.vue +++ b/src/client/app/desktop/views/components/drive.file.vue @@ -37,7 +37,6 @@ import i18n from '../../../i18n'; import copyToClipboard from '../../../common/scripts/copy-to-clipboard'; import updateAvatar from '../../api/update-avatar'; import updateBanner from '../../api/update-banner'; -import { appendQuery } from '../../../../../prelude/url'; import XFileThumbnail from '../../../common/views/components/drive-file-thumbnail.vue'; export default Vue.extend({ @@ -87,7 +86,8 @@ export default Vue.extend({ action: this.copyUrl }, { type: 'link', - href: appendQuery(this.file.url, 'download'), + href: this.file.url, + target: '_blank', text: this.$t('contextmenu.download'), icon: 'download', download: this.file.name diff --git a/src/client/app/mobile/views/components/drive.file-detail.vue b/src/client/app/mobile/views/components/drive.file-detail.vue index 224ff2f05..328982a16 100644 --- a/src/client/app/mobile/views/components/drive.file-detail.vue +++ b/src/client/app/mobile/views/components/drive.file-detail.vue @@ -57,7 +57,6 @@ import Vue from 'vue'; import i18n from '../../../i18n'; import { gcd } from '../../../../../prelude/math'; -import { appendQuery } from '../../../../../prelude/url'; import XFileThumbnail from '../../../common/views/components/drive-file-thumbnail.vue'; export default Vue.extend({ @@ -91,7 +90,7 @@ export default Vue.extend({ }, dlUrl(): string { - return appendQuery(this.file.url, 'download'); + return this.file.url; } }, diff --git a/src/server/file/send-drive-file.ts b/src/server/file/send-drive-file.ts index 44e88be8a..72b2d6073 100644 --- a/src/server/file/send-drive-file.ts +++ b/src/server/file/send-drive-file.ts @@ -46,9 +46,7 @@ export default async function(ctx: Koa.BaseContext) { ctx.set('Content-Disposition', contentDisposition('inline', `${rename(file.name, { suffix: '-web' })}`)); ctx.body = InternalStorage.read(key); } else { - if ('download' in ctx.query) { - ctx.set('Content-Disposition', contentDisposition('attachment', `${file.name}`)); - } + ctx.set('Content-Disposition', contentDisposition('inline', `${file.name}`)); const readable = InternalStorage.read(file.accessKey!); readable.on('error', commonReadableHandlerGenerator(ctx));