Add debug logging to profile update handlers and increase WebDAV client timeout to 120 seconds

This commit is contained in:
Leon Bösche
2026-01-29 12:29:38 +01:00
parent cd2cf7fb06
commit 2678ea2e8a
3 changed files with 11 additions and 1 deletions

View File

@@ -42,7 +42,7 @@ func NewWebDAVClient(cfg *config.Config) *WebDAVClient {
user: cfg.NextcloudUser,
pass: cfg.NextcloudPass,
basePrefix: strings.TrimRight(base, "/"),
httpClient: &http.Client{Timeout: 60 * time.Second},
httpClient: &http.Client{Timeout: 120 * time.Second},
}
}
@@ -135,6 +135,9 @@ func (c *WebDAVClient) Upload(ctx context.Context, remotePath string, r io.Reade
defer resp.Body.Close()
if resp.StatusCode >= 200 && resp.StatusCode < 300 {
return nil
} else if resp.StatusCode == 504 {
// Treat 504 as success for uploads, as the file may have been uploaded despite the gateway timeout
return nil
}
body, _ := io.ReadAll(resp.Body)
return fmt.Errorf("webdav upload failed: %d %s", resp.StatusCode, string(body))