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 {
|
try {
|
||||||
// Query the directory containing the file, not the file itself
|
const path = `${this.filePath}/${basename}`
|
||||||
const client = davGetClient()
|
const client = davGetClient()
|
||||||
const results = await client.getDirectoryContents(`${davRootPath}${this.filePath}`, {
|
const results = await client.getDirectoryContents(`${davRootPath}${path}`, {
|
||||||
details: true,
|
details: true,
|
||||||
data: davGetDefaultPropfind(),
|
data: davGetDefaultPropfind(),
|
||||||
})
|
})
|
||||||
|
const nodes = results.data.map((result) => davResultToNode(result))
|
||||||
// Find the specific file in the directory listing
|
|
||||||
const nodes = results.data
|
|
||||||
.map((result) => davResultToNode(result))
|
|
||||||
.filter((node) => node.basename === basename)
|
|
||||||
|
|
||||||
if (nodes[0]) {
|
if (nodes[0]) {
|
||||||
console.debug('[FilesAppIntegration] Emitting files:node:created for', basename)
|
console.debug('[FilesAppIntegration] Emitting files:node:created for', basename)
|
||||||
emit('files:node:created', nodes[0])
|
emit('files:node:created', nodes[0])
|
||||||
} else {
|
} else {
|
||||||
console.warn('[FilesAppIntegration] New file not found in directory:', basename)
|
console.warn('[FilesAppIntegration] New file not found:', basename)
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('Failed to fetch new file metadata from webdav', e)
|
console.error('Failed to fetch new file metadata from webdav', e)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue