Skip to content

Commit 4d9cc0d

Browse files
committed
chore: adjust code for breaking changes of @nextcloud/paths v3
Signed-off-by: Ferdinand Thiessen <[email protected]>
1 parent 6f149dc commit 4d9cc0d

File tree

8 files changed

+17
-17
lines changed

8 files changed

+17
-17
lines changed

apps/files/src/services/DropService.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@ import type { RootDirectory } from './DropServiceUtils.ts'
1010
import { showError, showInfo, showSuccess, showWarning } from '@nextcloud/dialogs'
1111
import { NodeStatus } from '@nextcloud/files'
1212
import { getRootPath } from '@nextcloud/files/dav'
13-
import { translate as t } from '@nextcloud/l10n'
14-
import { joinPaths } from '@nextcloud/paths'
13+
import { t } from '@nextcloud/l10n'
14+
import { join } from '@nextcloud/paths'
1515
import { getUploader, hasConflict } from '@nextcloud/upload'
16-
import { join } from 'path'
1716
import Vue from 'vue'
1817
import { handleCopyMoveNodeTo } from '../actions/moveOrCopyAction.ts'
1918
import { MoveCopyAction } from '../actions/moveOrCopyActionUtils.ts'
@@ -126,7 +125,7 @@ export async function onDropExternalFiles(root: RootDirectory, destination: Fold
126125
// If the file is a directory, we need to create it first
127126
// then browse its tree and upload its contents.
128127
if (file instanceof Directory) {
129-
const absolutePath = joinPaths(getRootPath(), destination.path, relativePath)
128+
const absolutePath = join(getRootPath(), destination.path, relativePath)
130129
try {
131130
logger.debug('Processing directory', { relativePath })
132131
await createDirectoryIfNotExists(absolutePath)

apps/files/src/services/FolderTree.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { getCurrentUser } from '@nextcloud/auth'
1010
import axios from '@nextcloud/axios'
1111
import { getRemoteURL } from '@nextcloud/files/dav'
1212
import { getCanonicalLocale, getLanguage } from '@nextcloud/l10n'
13-
import { dirname, encodePath, joinPaths } from '@nextcloud/paths'
13+
import { dirname, encodePath, join } from '@nextcloud/paths'
1414
import { generateOcsUrl } from '@nextcloud/router'
1515
import { getContents as getFiles } from './Files.ts'
1616

@@ -55,7 +55,7 @@ const compareNodes = (a: TreeNodeData, b: TreeNodeData) => collator.compare(a.di
5555
function getTreeNodes(tree: Tree, currentPath: string = '/', nodes: TreeNode[] = []): TreeNode[] {
5656
const sortedTree = tree.toSorted(compareNodes)
5757
for (const { id, basename, displayName, children } of sortedTree) {
58-
const path = joinPaths(currentPath, basename)
58+
const path = join(currentPath, basename)
5959
const source = `${sourceRoot}${path}`
6060
const node: TreeNode = {
6161
source,

apps/files/src/store/renaming.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import axios, { isAxiosError } from '@nextcloud/axios'
88
import { emit, subscribe } from '@nextcloud/event-bus'
99
import { FileType, NodeStatus } from '@nextcloud/files'
1010
import { t } from '@nextcloud/l10n'
11+
import { basename, dirname, extname } from '@nextcloud/paths'
1112
import { spawnDialog } from '@nextcloud/vue/functions/dialog'
12-
import { basename, dirname, extname } from 'path'
1313
import { defineStore } from 'pinia'
1414
import Vue, { defineAsyncComponent, ref } from 'vue'
1515
import logger from '../logger.ts'
@@ -36,7 +36,7 @@ export const useRenamingStore = defineStore('renaming', () => {
3636
* This will rename the node set as `renamingNode` to the configured new name `newName`.
3737
*
3838
* @return true if success, false if skipped (e.g. new and old name are the same)
39-
* @throws Error if renaming fails, details are set in the error message
39+
* @throws {Error} if renaming fails, details are set in the error message
4040
*/
4141
async function rename(): Promise<boolean> {
4242
if (renamingNode.value === undefined) {

apps/files/src/views/FilesList.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,11 @@ import { Folder, getFileListActions, Permission, sortNodes } from '@nextcloud/fi
174174
import { getRemoteURL, getRootPath } from '@nextcloud/files/dav'
175175
import { loadState } from '@nextcloud/initial-state'
176176
import { translate as t } from '@nextcloud/l10n'
177+
import { dirname, join } from '@nextcloud/paths'
177178
import { ShareType } from '@nextcloud/sharing'
178179
import { UploadPicker, UploadStatus } from '@nextcloud/upload'
179180
import { useThrottleFn } from '@vueuse/core'
180-
import { dirname, join, normalize, relative } from 'path'
181+
import { normalize, relative } from 'node:path'
181182
import { defineComponent } from 'vue'
182183
import NcActionButton from '@nextcloud/vue/components/NcActionButton'
183184
import NcActions from '@nextcloud/vue/components/NcActions'

apps/files_trashbin/src/files_views/columns.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ function parseOriginalLocation(node: Node): string {
9999
}
100100

101101
const dir = dirname(path)
102-
if (dir === path) { // Node is in root folder
102+
if (dir === '/' || dir === '.') { // Node is in root folder
103103
return t('files_trashbin', 'All files')
104104
}
105105

apps/files_versions/src/components/VersionEntry.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ import { formatFileSize, Permission } from '@nextcloud/files'
140140
import { loadState } from '@nextcloud/initial-state'
141141
import { t } from '@nextcloud/l10n'
142142
import moment from '@nextcloud/moment'
143-
import { joinPaths } from '@nextcloud/paths'
143+
import { join } from '@nextcloud/paths'
144144
import { getRootUrl } from '@nextcloud/router'
145145
import { computed, nextTick, ref } from 'vue'
146146
import NcActionButton from '@nextcloud/vue/components/NcActionButton'
@@ -240,7 +240,7 @@ const versionHumanExplicitDate = computed(() => {
240240
241241
const downloadURL = computed(() => {
242242
if (props.isCurrent) {
243-
return getRootUrl() + joinPaths('/remote.php/webdav', props.fileInfo.path, props.fileInfo.name)
243+
return getRootUrl() + join('/remote.php/webdav', props.fileInfo.path, props.fileInfo.name)
244244
} else {
245245
return getRootUrl() + props.version.url
246246
}

apps/files_versions/src/utils/versions.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import type { FileStat, ResponseDataDetailed } from 'webdav'
1010
import { getCurrentUser } from '@nextcloud/auth'
1111
import axios from '@nextcloud/axios'
1212
import moment from '@nextcloud/moment'
13-
import { encodePath, joinPaths } from '@nextcloud/paths'
13+
import { encodePath, join } from '@nextcloud/paths'
1414
import { generateRemoteUrl, generateUrl } from '@nextcloud/router'
1515
import client from '../utils/davClient.ts'
1616
import davRequest from '../utils/davRequest.ts'
@@ -96,7 +96,7 @@ function formatVersion(version: any, fileInfo: any): Version {
9696
})
9797
} else {
9898
previewUrl = generateUrl('/apps/files_versions/preview?file={file}&version={fileVersion}&mimeFallback=1', {
99-
file: joinPaths(fileInfo.path, fileInfo.name),
99+
file: join(fileInfo.path, fileInfo.name),
100100
fileVersion: version.basename,
101101
})
102102
}
@@ -116,7 +116,7 @@ function formatVersion(version: any, fileInfo: any): Version {
116116
mtime,
117117
permissions: 'R',
118118
previewUrl,
119-
url: joinPaths('/remote.php/dav', version.filename),
119+
url: join('/remote.php/dav', version.filename),
120120
source: generateRemoteUrl('dav') + encodePath(version.filename),
121121
fileVersion: version.basename,
122122
}

core/src/OC/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
dirname,
1515
encodePath,
1616
isSamePath,
17-
joinPaths,
17+
join,
1818
} from '@nextcloud/paths'
1919
import {
2020
generateFilePath,
@@ -170,7 +170,7 @@ export default {
170170
/**
171171
* @deprecated 18.0.0 use https://www.npmjs.com/package/@nextcloud/paths
172172
*/
173-
joinPaths,
173+
joinPaths: join,
174174

175175
/**
176176
* @deprecated 20.0.0 use `getCanonicalLocale` from https://www.npmjs.com/package/@nextcloud/l10n

0 commit comments

Comments
 (0)