chore: adjust code for breaking changes of @nextcloud/paths v3

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
This commit is contained in:
Ferdinand Thiessen 2025-12-22 01:52:22 +01:00
parent 0d890d4217
commit 9a1fd7a629
No known key found for this signature in database
GPG key ID: 45FAE7268762B400
8 changed files with 17 additions and 17 deletions

View file

@ -10,10 +10,9 @@ import type { RootDirectory } from './DropServiceUtils.ts'
import { showError, showInfo, showSuccess, showWarning } from '@nextcloud/dialogs'
import { NodeStatus } from '@nextcloud/files'
import { getRootPath } from '@nextcloud/files/dav'
import { translate as t } from '@nextcloud/l10n'
import { joinPaths } from '@nextcloud/paths'
import { t } from '@nextcloud/l10n'
import { join } from '@nextcloud/paths'
import { getUploader, hasConflict } from '@nextcloud/upload'
import { join } from 'path'
import Vue from 'vue'
import { handleCopyMoveNodeTo } from '../actions/moveOrCopyAction.ts'
import { MoveCopyAction } from '../actions/moveOrCopyActionUtils.ts'
@ -126,7 +125,7 @@ export async function onDropExternalFiles(root: RootDirectory, destination: Fold
// If the file is a directory, we need to create it first
// then browse its tree and upload its contents.
if (file instanceof Directory) {
const absolutePath = joinPaths(getRootPath(), destination.path, relativePath)
const absolutePath = join(getRootPath(), destination.path, relativePath)
try {
logger.debug('Processing directory', { relativePath })
await createDirectoryIfNotExists(absolutePath)

View file

@ -10,7 +10,7 @@ import { getCurrentUser } from '@nextcloud/auth'
import axios from '@nextcloud/axios'
import { getRemoteURL } from '@nextcloud/files/dav'
import { getCanonicalLocale, getLanguage } from '@nextcloud/l10n'
import { dirname, encodePath, joinPaths } from '@nextcloud/paths'
import { dirname, encodePath, join } from '@nextcloud/paths'
import { generateOcsUrl } from '@nextcloud/router'
import { getContents as getFiles } from './Files.ts'
@ -55,7 +55,7 @@ const compareNodes = (a: TreeNodeData, b: TreeNodeData) => collator.compare(a.di
function getTreeNodes(tree: Tree, currentPath: string = '/', nodes: TreeNode[] = []): TreeNode[] {
const sortedTree = tree.toSorted(compareNodes)
for (const { id, basename, displayName, children } of sortedTree) {
const path = joinPaths(currentPath, basename)
const path = join(currentPath, basename)
const source = `${sourceRoot}${path}`
const node: TreeNode = {
source,

View file

@ -8,8 +8,8 @@ import axios, { isAxiosError } from '@nextcloud/axios'
import { emit, subscribe } from '@nextcloud/event-bus'
import { FileType, NodeStatus } from '@nextcloud/files'
import { t } from '@nextcloud/l10n'
import { basename, dirname, extname } from '@nextcloud/paths'
import { spawnDialog } from '@nextcloud/vue/functions/dialog'
import { basename, dirname, extname } from 'path'
import { defineStore } from 'pinia'
import Vue, { defineAsyncComponent, ref } from 'vue'
import logger from '../logger.ts'
@ -36,7 +36,7 @@ export const useRenamingStore = defineStore('renaming', () => {
* This will rename the node set as `renamingNode` to the configured new name `newName`.
*
* @return true if success, false if skipped (e.g. new and old name are the same)
* @throws Error if renaming fails, details are set in the error message
* @throws {Error} if renaming fails, details are set in the error message
*/
async function rename(): Promise<boolean> {
if (renamingNode.value === undefined) {

View file

@ -174,10 +174,11 @@ import { Folder, getFileListActions, Permission, sortNodes } from '@nextcloud/fi
import { getRemoteURL, getRootPath } from '@nextcloud/files/dav'
import { loadState } from '@nextcloud/initial-state'
import { translate as t } from '@nextcloud/l10n'
import { dirname, join } from '@nextcloud/paths'
import { ShareType } from '@nextcloud/sharing'
import { UploadPicker, UploadStatus } from '@nextcloud/upload'
import { useThrottleFn } from '@vueuse/core'
import { dirname, join, normalize, relative } from 'path'
import { normalize, relative } from 'path'
import { defineComponent } from 'vue'
import NcActionButton from '@nextcloud/vue/components/NcActionButton'
import NcActions from '@nextcloud/vue/components/NcActions'

View file

@ -99,7 +99,7 @@ function parseOriginalLocation(node: Node): string {
}
const dir = dirname(path)
if (dir === path) { // Node is in root folder
if (dir === '/' || dir === '.') { // Node is in root folder
return t('files_trashbin', 'All files')
}

View file

@ -140,7 +140,7 @@ import { formatFileSize, Permission } from '@nextcloud/files'
import { loadState } from '@nextcloud/initial-state'
import { t } from '@nextcloud/l10n'
import moment from '@nextcloud/moment'
import { joinPaths } from '@nextcloud/paths'
import { join } from '@nextcloud/paths'
import { getRootUrl } from '@nextcloud/router'
import { computed, nextTick, ref } from 'vue'
import NcActionButton from '@nextcloud/vue/components/NcActionButton'
@ -240,7 +240,7 @@ const versionHumanExplicitDate = computed(() => {
const downloadURL = computed(() => {
if (props.isCurrent) {
return getRootUrl() + joinPaths('/remote.php/webdav', props.fileInfo.path, props.fileInfo.name)
return getRootUrl() + join('/remote.php/webdav', props.fileInfo.path, props.fileInfo.name)
} else {
return getRootUrl() + props.version.url
}

View file

@ -10,7 +10,7 @@ import type { FileStat, ResponseDataDetailed } from 'webdav'
import { getCurrentUser } from '@nextcloud/auth'
import axios from '@nextcloud/axios'
import moment from '@nextcloud/moment'
import { encodePath, joinPaths } from '@nextcloud/paths'
import { encodePath, join } from '@nextcloud/paths'
import { generateRemoteUrl, generateUrl } from '@nextcloud/router'
import client from '../utils/davClient.ts'
import davRequest from '../utils/davRequest.ts'
@ -96,7 +96,7 @@ function formatVersion(version: any, fileInfo: any): Version {
})
} else {
previewUrl = generateUrl('/apps/files_versions/preview?file={file}&version={fileVersion}&mimeFallback=1', {
file: joinPaths(fileInfo.path, fileInfo.name),
file: join(fileInfo.path, fileInfo.name),
fileVersion: version.basename,
})
}
@ -116,7 +116,7 @@ function formatVersion(version: any, fileInfo: any): Version {
mtime,
permissions: 'R',
previewUrl,
url: joinPaths('/remote.php/dav', version.filename),
url: join('/remote.php/dav', version.filename),
source: generateRemoteUrl('dav') + encodePath(version.filename),
fileVersion: version.basename,
}

View file

@ -14,7 +14,7 @@ import {
dirname,
encodePath,
isSamePath,
joinPaths,
join,
} from '@nextcloud/paths'
import {
generateFilePath,
@ -170,7 +170,7 @@ export default {
/**
* @deprecated 18.0.0 use https://www.npmjs.com/package/@nextcloud/paths
*/
joinPaths,
joinPaths: join,
/**
* @deprecated 20.0.0 use `getCanonicalLocale` from https://www.npmjs.com/package/@nextcloud/l10n