Skip to content

Commit 7689588

Browse files
authored
Merge pull request #50109 from nextcloud/artonge/fix/remove_duplicate_propfind_call
fix: Remove duplicate propfind call
2 parents 0f2dcfd + 5faaeca commit 7689588

File tree

5 files changed

+40
-35
lines changed

5 files changed

+40
-35
lines changed

apps/files/src/services/FileInfo.js

Lines changed: 0 additions & 30 deletions
This file was deleted.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/**
2+
* SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
3+
* SPDX-License-Identifier: AGPL-3.0-or-later
4+
*/
5+
6+
/* eslint-disable jsdoc/require-jsdoc */
7+
8+
import type { Node } from '@nextcloud/files'
9+
10+
export default function(node: Node) {
11+
const fileInfo = new OC.Files.FileInfo({
12+
id: node.fileid,
13+
path: node.dirname,
14+
name: node.basename,
15+
mtime: node.mtime?.getTime(),
16+
etag: node.attributes.etag,
17+
size: node.size,
18+
hasPreview: node.attributes.hasPreview,
19+
isEncrypted: node.attributes.isEncrypted === 1,
20+
isFavourited: node.attributes.favorite === 1,
21+
mimetype: node.mime,
22+
permissions: node.permissions,
23+
mountType: node.attributes['mount-type'],
24+
sharePermissions: node.attributes['share-permissions'],
25+
shareAttributes: JSON.parse(node.attributes['share-attributes']),
26+
type: node.type === 'file' ? 'file' : 'dir',
27+
})
28+
29+
// TODO remove when no more legacy backbone is used
30+
fileInfo.get = (key) => fileInfo[key]
31+
fileInfo.isDirectory = () => fileInfo.mimetype === 'httpd/unix-directory'
32+
fileInfo.canEdit = () => Boolean(fileInfo.permissions & OC.PERMISSION_UPDATE)
33+
34+
return fileInfo
35+
}

apps/files/src/views/Sidebar.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -487,10 +487,10 @@ export default {
487487
this.loading = true
488488
489489
try {
490-
this.fileInfo = await FileInfo(this.davPath)
490+
this.node = await fetchNode({ path: this.file })
491+
this.fileInfo = FileInfo(this.node)
491492
// adding this as fallback because other apps expect it
492493
this.fileInfo.dir = this.file.split('/').slice(0, -1).join('/')
493-
this.node = await fetchNode({ path: (this.fileInfo.path + '/' + this.fileInfo.name).replace('//', '/') })
494494
495495
// DEPRECATED legacy views
496496
// TODO: remove

dist/files-sidebar.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/files-sidebar.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)