Skip to content

Commit 1894e49

Browse files
committed
fix(files): use displayname rather than basename to use progress
- resolves nextcloud/end_to_end_encryption#1733 The internal basename is often not known by users, e.g. groupfolders or in this case e2ee can define displaynames other than the shown name. Same for e.g. mount points of shares. So we need to show the displayname instead. Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
1 parent ddf2cef commit 1894e49

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

apps/files/src/actions/moveOrCopyAction.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ import { FilePickerClosed, getFilePickerBuilder, openConflictPicker, showError,
1414
import { emit } from '@nextcloud/event-bus'
1515
import { FileType, getUniqueName, NodeStatus, Permission } from '@nextcloud/files'
1616
import { defaultRootPath, getClient, getDefaultPropfind, resultToNode } from '@nextcloud/files/dav'
17-
import { t } from '@nextcloud/l10n'
17+
import { n, t } from '@nextcloud/l10n'
18+
import { basename, join } from '@nextcloud/paths'
1819
import { getConflicts } from '@nextcloud/upload'
19-
import { basename, join } from 'path'
2020
import Vue from 'vue'
2121
import { getContents } from '../services/Files.ts'
2222
import { logger } from '../utils/logger.ts'
@@ -156,7 +156,11 @@ export async function* handleCopyMoveNodesTo(nodes: INode[], destination: IFolde
156156
}
157157
}
158158

159-
const actionFinished = createLoadingNotification(method, nodes.map((node) => node.basename), destination.path)
159+
const actionFinished = createLoadingNotification(
160+
method,
161+
nodes.map((node) => node.displayname),
162+
join(destination.dirname, destination.displayname),
163+
)
160164
const queue = getQueue()
161165
try {
162166
for (const node of nodes) {
@@ -246,11 +250,11 @@ function createLoadingNotification(mode: MoveCopyAction, sources: string[], dest
246250
const text = mode === MoveCopyAction.MOVE
247251
? (sources.length === 1
248252
? t('files', 'Moving "{source}" to "{destination}" …', { source: sources[0]!, destination })
249-
: t('files', 'Moving {count} files to "{destination}" …', { count: sources.length, destination })
253+
: n('files', 'Moving %n file to "{destination}" …', 'Moving %n files to "{destination}" …', sources.length, { destination })
250254
)
251255
: (sources.length === 1
252256
? t('files', 'Copying "{source}" to "{destination}" …', { source: sources[0]!, destination })
253-
: t('files', 'Copying {count} files to "{destination}" …', { count: sources.length, destination })
257+
: n('files', 'Copying %n file to "{destination}" …', 'Copying %n files to "{destination}" …', sources.length, { destination })
254258
)
255259

256260
const toast = showLoading(text)
@@ -324,7 +328,7 @@ async function openFilePickerForAction(
324328

325329
if (action === MoveCopyAction.MOVE || action === MoveCopyAction.MOVE_OR_COPY) {
326330
buttons.push({
327-
label: target ? t('files', 'Move to {target}', { target }, undefined, { escape: false, sanitize: false }) : t('files', 'Move'),
331+
label: target ? t('files', 'Move to {target}', { target }, { escape: false, sanitize: false }) : t('files', 'Move'),
328332
variant: action === MoveCopyAction.MOVE ? 'primary' : 'secondary',
329333
icon: FolderMoveSvg,
330334
async callback(destination) {

0 commit comments

Comments
 (0)