Skip to content

Commit e2856da

Browse files
Merge pull request #57998 from nextcloud/backport/57990/stable33
[stable33] fix(files): keep current folder on drag-n-drop
2 parents 31621b5 + c40445b commit e2856da

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

apps/files/src/components/DragAndDropNotice.vue

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
<script lang="ts">
3030
import type { Folder } from '@nextcloud/files'
3131
import type { PropType } from 'vue'
32-
import type { RawLocation } from 'vue-router'
3332
3433
import { showError } from '@nextcloud/dialogs'
3534
import { Permission } from '@nextcloud/files'
@@ -111,7 +110,7 @@ export default defineComponent({
111110
mainContent.addEventListener('drop', this.onContentDrop)
112111
},
113112
114-
beforeDestroy() {
113+
beforeUnmount() {
115114
const mainContent = window.document.getElementById('app-content-vue') as HTMLElement
116115
mainContent.removeEventListener('dragover', this.onDragOver)
117116
mainContent.removeEventListener('dragleave', this.onDragLeave)
@@ -204,16 +203,19 @@ export default defineComponent({
204203
&& upload.source.replace(folder.source, '').split('/').length === 2)
205204
206205
if (lastUpload !== undefined) {
206+
const fileid = String(lastUpload.response!.headers['oc-fileid']).split(/(oc|nc)/, 2)[0]!
207207
logger.debug('Scrolling to last upload in current folder', { lastUpload })
208-
const location: RawLocation = {
209-
path: this.$route.path,
210-
// Keep params but change file id
208+
this.$router.push({
209+
name: this.$route.name!,
211210
params: {
211+
// Keep params but change file id
212212
...this.$route.params,
213-
fileid: String(lastUpload.response!.headers['oc-fileid']),
213+
fileid,
214214
},
215-
}
216-
this.$router.push(location)
215+
query: {
216+
dir: this.$route.query.dir,
217+
},
218+
})
217219
}
218220
219221
this.dragover = false

dist/files-main.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/files-main.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)