Add debug logging to profile update handlers and increase WebDAV client timeout to 120 seconds
This commit is contained in:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user