mirror of
https://github.com/nextcloud/richdocuments.git
synced 2025-12-17 21:12:14 +01:00
refactor by querying specific file
Signed-off-by: silver <s.szmajduch@posteo.de>
This commit is contained in:
parent
cfbdee7b8c
commit
7700b4bd4a
1 changed files with 4 additions and 8 deletions
|
|
@ -550,23 +550,19 @@ export default {
|
|||
}
|
||||
|
||||
try {
|
||||
// Query the directory containing the file, not the file itself
|
||||
const path = `${this.filePath}/${basename}`
|
||||
const client = davGetClient()
|
||||
const results = await client.getDirectoryContents(`${davRootPath}${this.filePath}`, {
|
||||
const results = await client.getDirectoryContents(`${davRootPath}${path}`, {
|
||||
details: true,
|
||||
data: davGetDefaultPropfind(),
|
||||
})
|
||||
|
||||
// Find the specific file in the directory listing
|
||||
const nodes = results.data
|
||||
.map((result) => davResultToNode(result))
|
||||
.filter((node) => node.basename === basename)
|
||||
const nodes = results.data.map((result) => davResultToNode(result))
|
||||
|
||||
if (nodes[0]) {
|
||||
console.debug('[FilesAppIntegration] Emitting files:node:created for', basename)
|
||||
emit('files:node:created', nodes[0])
|
||||
} else {
|
||||
console.warn('[FilesAppIntegration] New file not found in directory:', basename)
|
||||
console.warn('[FilesAppIntegration] New file not found:', basename)
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Failed to fetch new file metadata from webdav', e)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue