ダウンロードURLにdownloadを付けないなど (#5488)
This commit is contained in:
parent
2671c6b4f2
commit
d17c6adba4
|
@ -37,7 +37,6 @@ import i18n from '../../../i18n';
|
||||||
import copyToClipboard from '../../../common/scripts/copy-to-clipboard';
|
import copyToClipboard from '../../../common/scripts/copy-to-clipboard';
|
||||||
import updateAvatar from '../../api/update-avatar';
|
import updateAvatar from '../../api/update-avatar';
|
||||||
import updateBanner from '../../api/update-banner';
|
import updateBanner from '../../api/update-banner';
|
||||||
import { appendQuery } from '../../../../../prelude/url';
|
|
||||||
import XFileThumbnail from '../../../common/views/components/drive-file-thumbnail.vue';
|
import XFileThumbnail from '../../../common/views/components/drive-file-thumbnail.vue';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
|
@ -87,7 +86,8 @@ export default Vue.extend({
|
||||||
action: this.copyUrl
|
action: this.copyUrl
|
||||||
}, {
|
}, {
|
||||||
type: 'link',
|
type: 'link',
|
||||||
href: appendQuery(this.file.url, 'download'),
|
href: this.file.url,
|
||||||
|
target: '_blank',
|
||||||
text: this.$t('contextmenu.download'),
|
text: this.$t('contextmenu.download'),
|
||||||
icon: 'download',
|
icon: 'download',
|
||||||
download: this.file.name
|
download: this.file.name
|
||||||
|
|
|
@ -57,7 +57,6 @@
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import i18n from '../../../i18n';
|
import i18n from '../../../i18n';
|
||||||
import { gcd } from '../../../../../prelude/math';
|
import { gcd } from '../../../../../prelude/math';
|
||||||
import { appendQuery } from '../../../../../prelude/url';
|
|
||||||
import XFileThumbnail from '../../../common/views/components/drive-file-thumbnail.vue';
|
import XFileThumbnail from '../../../common/views/components/drive-file-thumbnail.vue';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
|
@ -91,7 +90,7 @@ export default Vue.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
dlUrl(): string {
|
dlUrl(): string {
|
||||||
return appendQuery(this.file.url, 'download');
|
return this.file.url;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -46,9 +46,7 @@ export default async function(ctx: Koa.BaseContext) {
|
||||||
ctx.set('Content-Disposition', contentDisposition('inline', `${rename(file.name, { suffix: '-web' })}`));
|
ctx.set('Content-Disposition', contentDisposition('inline', `${rename(file.name, { suffix: '-web' })}`));
|
||||||
ctx.body = InternalStorage.read(key);
|
ctx.body = InternalStorage.read(key);
|
||||||
} else {
|
} else {
|
||||||
if ('download' in ctx.query) {
|
ctx.set('Content-Disposition', contentDisposition('inline', `${file.name}`));
|
||||||
ctx.set('Content-Disposition', contentDisposition('attachment', `${file.name}`));
|
|
||||||
}
|
|
||||||
|
|
||||||
const readable = InternalStorage.read(file.accessKey!);
|
const readable = InternalStorage.read(file.accessKey!);
|
||||||
readable.on('error', commonReadableHandlerGenerator(ctx));
|
readable.on('error', commonReadableHandlerGenerator(ctx));
|
||||||
|
|
Loading…
Reference in New Issue