Fix profile avatar and display name issues
- Increase Dio receiveTimeout to 120s for file uploads - Reduce WebDAV client timeout to 30s - Add cache-busting v parameter to avatar URLs - Add hasChanges logic to disable Save button when no changes made
This commit is contained in:
@@ -3848,7 +3848,7 @@ func getUserProfileHandler(w http.ResponseWriter, r *http.Request, db *database.
|
||||
|
||||
// If avatar exists, return the backend URL instead of the internal WebDAV URL
|
||||
if user.AvatarURL != nil && *user.AvatarURL != "" {
|
||||
user.AvatarURL = &[]string{"/user/avatar"}[0]
|
||||
user.AvatarURL = &[]string{fmt.Sprintf("/user/avatar?v=%d", time.Now().Unix())}[0]
|
||||
}
|
||||
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
@@ -4048,7 +4048,7 @@ func uploadUserAvatarHandler(w http.ResponseWriter, r *http.Request, db *databas
|
||||
|
||||
// Get public URL - for now, construct it manually since Nextcloud doesn't provide direct public URLs
|
||||
// In a real setup, you'd configure Nextcloud to serve public URLs or use a CDN
|
||||
publicURL := "/user/avatar"
|
||||
publicURL := fmt.Sprintf("/user/avatar?v=%d", time.Now().Unix())
|
||||
webdavURL := fmt.Sprintf("%s/%s", client.BaseURL, avatarPath)
|
||||
|
||||
// Update user profile with avatar URL
|
||||
|
||||
@@ -42,7 +42,7 @@ func NewWebDAVClient(cfg *config.Config) *WebDAVClient {
|
||||
user: cfg.NextcloudUser,
|
||||
pass: cfg.NextcloudPass,
|
||||
basePrefix: strings.TrimRight(base, "/"),
|
||||
httpClient: &http.Client{Timeout: 120 * time.Second},
|
||||
httpClient: &http.Client{Timeout: 30 * time.Second},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user