Skip to content

Commit

Permalink
fix: Remove duplicate propfind call
Browse files Browse the repository at this point in the history
This also was an XHR call which is not going through the end to end encryption proxy

Signed-off-by: Louis Chemineau <[email protected]>
  • Loading branch information
artonge committed Jan 13, 2025
1 parent 9c717aa commit 45ec577
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 32 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: node.attributes['share-attributes'],
type: node.type,
})

// 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

0 comments on commit 45ec577

Please sign in to comment.