Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions apps/files/src/actions/moveOrCopyAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import CopyIconSvg from '@mdi/svg/svg/folder-multiple-outline.svg?raw'
import { isAxiosError } from '@nextcloud/axios'
import { FilePickerClosed, getFilePickerBuilder, showError, showInfo, TOAST_PERMANENT_TIMEOUT } from '@nextcloud/dialogs'
import { emit } from '@nextcloud/event-bus'
import { davGetClient, davGetDefaultPropfind, davResultToNode, davRootPath, FileAction, FileType, getUniqueName, NodeStatus, Permission } from '@nextcloud/files'
import { FileAction, FileType, getUniqueName, NodeStatus, Permission } from '@nextcloud/files'
import { defaultRootPath, getClient, getDefaultPropfind, resultToNode } from '@nextcloud/files/dav'
import { translate as t } from '@nextcloud/l10n'
import { hasConflict, openConflictPicker } from '@nextcloud/upload'
import { basename, join } from 'path'
Expand Down Expand Up @@ -119,9 +120,9 @@ export async function handleCopyMoveNodeTo(node: Node, destination: Folder, meth
}

try {
const client = davGetClient()
const currentPath = join(davRootPath, node.path)
const destinationPath = join(davRootPath, destination.path)
const client = getClient()
const currentPath = join(defaultRootPath, node.path)
const destinationPath = join(defaultRootPath, destination.path)

if (method === MoveCopyAction.COPY) {
let target = node.basename
Expand All @@ -144,10 +145,10 @@ export async function handleCopyMoveNodeTo(node: Node, destination: Folder, meth
join(destinationPath, target),
{
details: true,
data: davGetDefaultPropfind(),
data: getDefaultPropfind(),
},
) as ResponseDataDetailed<FileStat>
emit('files:node:created', davResultToNode(data))
emit('files:node:created', resultToNode(data))
}
} else {
// show conflict file popup if we do not allow overwriting
Expand Down Expand Up @@ -227,6 +228,10 @@ async function openFilePickerForAction(
// We don't want to show the current nodes in the file picker
return !fileIDs.includes(n.fileid)
})
.setCanPick((n) => {
const hasCreatePermissions = (n.permissions & Permission.CREATE) === Permission.CREATE
return hasCreatePermissions
})
.setMimeTypeFilter([])
.setMultiSelect(false)
.startAt(dir)
Expand All @@ -242,7 +247,6 @@ async function openFilePickerForAction(
label: target ? t('files', 'Copy to {target}', { target }, { escape: false, sanitize: false }) : t('files', 'Copy'),
variant: 'primary',
icon: CopyIconSvg,
disabled: selection.some((node) => (node.permissions & Permission.CREATE) === 0),
async callback(destination: Node[]) {
resolve({
destination: destination[0] as Folder,
Expand Down
4 changes: 2 additions & 2 deletions core/css/server.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion core/css/server.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/1543-1543.js.license
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ This file is generated from multiple sources. Included packages:
- version: 3.5.22
- license: MIT
- @nextcloud/dialogs
- version: 7.0.1
- version: 7.1.0
- license: AGPL-3.0-or-later
- semver
- version: 7.7.2
Expand Down
2 changes: 1 addition & 1 deletion dist/1626-1626.js.license
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ This file is generated from multiple sources. Included packages:
- version: 3.5.22
- license: MIT
- @nextcloud/dialogs
- version: 7.0.1
- version: 7.1.0
- license: AGPL-3.0-or-later
- semver
- version: 7.7.2
Expand Down
Loading
Loading