fix: WebDAV in Backup-Tab, mkdirp robuster, Sync-Fehler blockieren keine Uploads

This commit is contained in:
2026-06-14 02:17:40 +02:00
parent 3d76ae9ce5
commit c3b8ff96de
3 changed files with 11 additions and 7 deletions

View File

@@ -77,8 +77,10 @@ async function mkdirp(davPath) {
for (const part of parts) {
current += '/' + part;
const r = await davRequest('MKCOL', current);
if (r.status !== 201 && r.status !== 405) { // 405 = schon vorhanden
throw new Error(`MKCOL ${current}${r.status}`);
// 201 = erstellt, 301/405/409/423 = schon vorhanden oder Konflikt (ignorieren)
const ok = [201, 301, 405, 409, 423].includes(r.status);
if (!ok) {
console.warn(`[webdav mkdirp] MKCOL ${current}${r.status} (ignoriert)`);
}
}
}
@@ -97,7 +99,9 @@ function userPath(cfg, username) {
* @param {string} mimeType
*/
async function uploadFile(buffer, davPath, mimeType = 'application/octet-stream') {
await mkdirp(davPath.split('/').slice(0, -1).join('/'));
try { await mkdirp(davPath.split('/').slice(0, -1).join('/')); } catch(e) {
console.warn('[webdav] mkdirp warning:', e.message);
}
const r = await new Promise((resolve, reject) => {
const cfg = getConfig();
const base = new URL(cfg.url);