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

@@ -263,7 +263,7 @@ router.post('/webdav/sync', authenticate, requireAdmin, async (req, res) => {
// User-Basisordner // User-Basisordner
try { await webdav.mkdirp(userBase); results.folders++; } catch(e) { try { await webdav.mkdirp(userBase); results.folders++; } catch(e) {
results.errors.push(`Ordner ${userBase}: ${e.message}`); console.warn('[sync] mkdirp', userBase, e.message);
} }
// Upload-Freigabe Ordner // Upload-Freigabe Ordner

View File

@@ -77,8 +77,10 @@ async function mkdirp(davPath) {
for (const part of parts) { for (const part of parts) {
current += '/' + part; current += '/' + part;
const r = await davRequest('MKCOL', current); const r = await davRequest('MKCOL', current);
if (r.status !== 201 && r.status !== 405) { // 405 = schon vorhanden // 201 = erstellt, 301/405/409/423 = schon vorhanden oder Konflikt (ignorieren)
throw new Error(`MKCOL ${current}${r.status}`); 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 * @param {string} mimeType
*/ */
async function uploadFile(buffer, davPath, mimeType = 'application/octet-stream') { 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 r = await new Promise((resolve, reject) => {
const cfg = getConfig(); const cfg = getConfig();
const base = new URL(cfg.url); const base = new URL(cfg.url);

View File

@@ -2991,9 +2991,6 @@ function AdminPanel({ toast, mobile, user, nav }) {
<Sec title="TMDB API (KINO-FEATURE)"> <Sec title="TMDB API (KINO-FEATURE)">
<TmdbSettings toast={toast}/> <TmdbSettings toast={toast}/>
</Sec> </Sec>
<Sec title="SYNOLOGY NAS / WEBDAV">
<WebDavSettings toast={toast}/>
</Sec>
</div> </div>
)} )}
@@ -3031,6 +3028,9 @@ function AdminPanel({ toast, mobile, user, nav }) {
</div> </div>
{file && <div style={{ color:'rgba(255,255,255,0.55)', fontSize:10, fontFamily:'monospace', marginTop:5 }}>{file.name}</div>} {file && <div style={{ color:'rgba(255,255,255,0.55)', fontSize:10, fontFamily:'monospace', marginTop:5 }}>{file.name}</div>}
</Sec> </Sec>
<Sec title="SYNOLOGY NAS / WEBDAV">
<WebDavSettings toast={toast}/>
</Sec>
</div> </div>
)} )}
</div> </div>