summaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
authortamaina <tamaina@hotmail.co.jp>2019-03-18 13:20:49 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2019-03-18 13:20:49 +0900
commitde47a17be7ce541fcd5c8ee698c2ef4aa926b5fb (patch)
tree667cc893d415dad545d5bf6a054fa7ce67982f1f /src/client
parent10.97.2 (diff)
downloadsharkey-de47a17be7ce541fcd5c8ee698c2ef4aa926b5fb.tar.gz
sharkey-de47a17be7ce541fcd5c8ee698c2ef4aa926b5fb.tar.bz2
sharkey-de47a17be7ce541fcd5c8ee698c2ef4aa926b5fb.zip
Improve drive downloading (#4523)
* Improve drive file downloading * fix name * wtf crlf * semicolon
Diffstat (limited to 'src/client')
-rw-r--r--src/client/app/desktop/views/components/context-menu.menu.vue2
-rw-r--r--src/client/app/desktop/views/components/drive.file.vue4
-rw-r--r--src/client/app/mobile/views/components/drive.file-detail.vue7
3 files changed, 10 insertions, 3 deletions
diff --git a/src/client/app/desktop/views/components/context-menu.menu.vue b/src/client/app/desktop/views/components/context-menu.menu.vue
index 1ae3c85d57..f2bb3bec23 100644
--- a/src/client/app/desktop/views/components/context-menu.menu.vue
+++ b/src/client/app/desktop/views/components/context-menu.menu.vue
@@ -6,7 +6,7 @@
<p @click="click(item)"><i v-if="item.icon" :class="$style.icon"><fa :icon="item.icon"/></i>{{ item.text }}</p>
</template>
<template v-else-if="item.type == 'link'">
- <a :href="item.href" :target="item.target" @click="click(item)"><i v-if="item.icon" :class="$style.icon"><fa :icon="item.icon"/></i>{{ item.text }}</a>
+ <a :href="item.href" :target="item.target" @click="click(item)" :download="item.download"><i v-if="item.icon" :class="$style.icon"><fa :icon="item.icon"/></i>{{ item.text }}</a>
</template>
<template v-else-if="item.type == 'nest'">
<p><i v-if="item.icon" :class="$style.icon"><fa :icon="item.icon"/></i>{{ item.text }}...<span class="caret"><fa icon="caret-right"/></span></p>
diff --git a/src/client/app/desktop/views/components/drive.file.vue b/src/client/app/desktop/views/components/drive.file.vue
index fbd649e8f6..b9d202f555 100644
--- a/src/client/app/desktop/views/components/drive.file.vue
+++ b/src/client/app/desktop/views/components/drive.file.vue
@@ -38,6 +38,7 @@ import anime from 'animejs';
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';
export default Vue.extend({
i18n: i18n('desktop/views/components/drive.file.vue'),
@@ -88,9 +89,10 @@ export default Vue.extend({
action: this.copyUrl
}, {
type: 'link',
- href: `${this.file.url}?download`,
+ href: appendQuery(this.file.url, 'download'),
text: this.$t('contextmenu.download'),
icon: 'download',
+ download: this.file.name
}, null, {
type: 'item',
text: this.$t('@.delete'),
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 4d0a747fcb..d7432437e0 100644
--- a/src/client/app/mobile/views/components/drive.file-detail.vue
+++ b/src/client/app/mobile/views/components/drive.file-detail.vue
@@ -38,7 +38,7 @@
<div class="menu">
<div>
<ui-input readonly :value="file.url">URL</ui-input>
- <ui-button link :href="`${file.url}?download`" :download="file.name"><fa icon="download"/> {{ $t('download') }}</ui-button>
+ <ui-button link :href="dlUrl" :download="file.name"><fa icon="download"/> {{ $t('download') }}</ui-button>
<ui-button @click="rename"><fa icon="pencil-alt"/> {{ $t('rename') }}</ui-button>
<ui-button @click="move"><fa :icon="['far', 'folder-open']"/> {{ $t('move') }}</ui-button>
<ui-button @click="toggleSensitive" v-if="file.isSensitive"><fa :icon="['far', 'eye']"/> {{ $t('unmark-as-sensitive') }}</ui-button>
@@ -61,6 +61,7 @@
import Vue from 'vue';
import i18n from '../../../i18n';
import { gcd } from '../../../../../prelude/math';
+import { appendQuery } from '../../../../../prelude/url';
export default Vue.extend({
i18n: i18n('mobile/views/components/drive.file-detail.vue'),
@@ -86,6 +87,10 @@ export default Vue.extend({
return this.file.properties.avgColor && this.file.properties.avgColor.length == 3 ? {
'background-color': `rgb(${ this.file.properties.avgColor.join(',') })`
} : {};
+ },
+
+ dlUrl(): string {
+ return appendQuery(this.file.url, 'download');
}
},