fix: avoid hiding remote lookup errors

This commit is contained in:
Tom Boullay
2026-04-27 17:22:26 +02:00
parent fd586f4185
commit 382b28103e
3 changed files with 11 additions and 16 deletions
+7 -6
View File
@@ -63,12 +63,13 @@ async function davRequest(
/** Check if a folder exists on the Nextcloud instance. */
export async function folderExists(path: string): Promise<boolean> {
try {
const res = await davRequest('PROPFIND', path + '/', null, { Depth: '0' })
return res.status >= 200 && res.status < 300
} catch {
return false
}
const res = await davRequest('PROPFIND', path + '/', null, { Depth: '0' })
if (res.status === 404) return false
if (res.status >= 200 && res.status < 300) return true
const text = await res.text().catch(() => '')
throw new Error(`PROPFIND ${path} failed (${res.status}): ${text.slice(0, 200)}`)
}
/**