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

@@ -131,6 +131,9 @@ class _AccountSettingsDialogState extends State<AccountSettingsDialog> {
} }
Future<void> _updateProfile() async { Future<void> _updateProfile() async {
print(
'DEBUG: _updateProfile called with displayName: ${_displayNameController.text}',
);
if (_currentUser == null) { if (_currentUser == null) {
return; return;
} }
@@ -158,6 +161,7 @@ class _AccountSettingsDialogState extends State<AccountSettingsDialog> {
); );
} }
} catch (e) { } catch (e) {
print('DEBUG: _updateProfile error: $e');
if (mounted) { if (mounted) {
// Show error message // Show error message
ScaffoldMessenger.of( ScaffoldMessenger.of(

View File

@@ -3857,6 +3857,7 @@ func getUserProfileHandler(w http.ResponseWriter, r *http.Request, db *database.
// updateUserProfileHandler updates the current user's profile information // updateUserProfileHandler updates the current user's profile information
func updateUserProfileHandler(w http.ResponseWriter, r *http.Request, db *database.DB, auditLogger *audit.Logger) { func updateUserProfileHandler(w http.ResponseWriter, r *http.Request, db *database.DB, auditLogger *audit.Logger) {
log.Printf("DEBUG: updateUserProfileHandler called")
userIDStr, ok := middleware.GetUserID(r.Context()) userIDStr, ok := middleware.GetUserID(r.Context())
if !ok { if !ok {
errors.WriteError(w, errors.CodeUnauthenticated, "Unauthorized", http.StatusUnauthorized) errors.WriteError(w, errors.CodeUnauthenticated, "Unauthorized", http.StatusUnauthorized)
@@ -3880,6 +3881,8 @@ func updateUserProfileHandler(w http.ResponseWriter, r *http.Request, db *databa
return return
} }
log.Printf("DEBUG: updateUserProfileHandler req: displayName=%v, email=%v, avatarUrl=%v", req.DisplayName, req.Email, req.AvatarURL)
// Build dynamic update query // Build dynamic update query
var setParts []string var setParts []string
var args []interface{} var args []interface{}

View File

@@ -42,7 +42,7 @@ func NewWebDAVClient(cfg *config.Config) *WebDAVClient {
user: cfg.NextcloudUser, user: cfg.NextcloudUser,
pass: cfg.NextcloudPass, pass: cfg.NextcloudPass,
basePrefix: strings.TrimRight(base, "/"), 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() defer resp.Body.Close()
if resp.StatusCode >= 200 && resp.StatusCode < 300 { if resp.StatusCode >= 200 && resp.StatusCode < 300 {
return nil 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) body, _ := io.ReadAll(resp.Body)
return fmt.Errorf("webdav upload failed: %d %s", resp.StatusCode, string(body)) return fmt.Errorf("webdav upload failed: %d %s", resp.StatusCode, string(body))