Skip to content

Commit

Permalink
Merge pull request #50109 from nextcloud/artonge/fix/remove_duplicate…
Browse files Browse the repository at this point in the history
…_propfind_call

fix: Remove duplicate propfind call
  • Loading branch information
artonge authored Jan 15, 2025
2 parents 0f2dcfd + 5faaeca commit 7689588
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 35 deletions.
30 changes: 0 additions & 30 deletions apps/files/src/services/FileInfo.js

This file was deleted.

35 changes: 35 additions & 0 deletions apps/files/src/services/FileInfo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/**
* SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

/* eslint-disable jsdoc/require-jsdoc */

import type { Node } from '@nextcloud/files'

export default function(node: Node) {
const fileInfo = new OC.Files.FileInfo({
id: node.fileid,
path: node.dirname,
name: node.basename,
mtime: node.mtime?.getTime(),
etag: node.attributes.etag,
size: node.size,
hasPreview: node.attributes.hasPreview,
isEncrypted: node.attributes.isEncrypted === 1,
isFavourited: node.attributes.favorite === 1,
mimetype: node.mime,
permissions: node.permissions,
mountType: node.attributes['mount-type'],
sharePermissions: node.attributes['share-permissions'],
shareAttributes: JSON.parse(node.attributes['share-attributes']),
type: node.type === 'file' ? 'file' : 'dir',
})

// TODO remove when no more legacy backbone is used
fileInfo.get = (key) => fileInfo[key]
fileInfo.isDirectory = () => fileInfo.mimetype === 'httpd/unix-directory'
fileInfo.canEdit = () => Boolean(fileInfo.permissions & OC.PERMISSION_UPDATE)

return fileInfo
}
4 changes: 2 additions & 2 deletions apps/files/src/views/Sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -487,10 +487,10 @@ export default {
this.loading = true

try {
this.fileInfo = await FileInfo(this.davPath)
this.node = await fetchNode({ path: this.file })
this.fileInfo = FileInfo(this.node)
// adding this as fallback because other apps expect it
this.fileInfo.dir = this.file.split('/').slice(0, -1).join('/')
this.node = await fetchNode({ path: (this.fileInfo.path + '/' + this.fileInfo.name).replace('//', '/') })

// DEPRECATED legacy views
// TODO: remove
Expand Down
4 changes: 2 additions & 2 deletions dist/files-sidebar.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/files-sidebar.js.map

Large diffs are not rendered by default.

0 comments on commit 7689588

Please sign in to comment.