Refactor file download URL construction to use ApiClient's base URL and ensure consistent remote path for user files
This commit is contained in:
@@ -1234,7 +1234,8 @@ func deleteUserFileHandler(w http.ResponseWriter, r *http.Request, db *database.
|
||||
// Delete from Nextcloud if configured
|
||||
if storageClient != nil {
|
||||
rel := strings.TrimPrefix(req.Path, "/")
|
||||
remotePath := path.Join("/user", userID.String(), rel)
|
||||
// Keep remote user workspace path consistent with uploads: "/users/<userID>/<rel>"
|
||||
remotePath := path.Join("/users", userID.String(), rel)
|
||||
if err := storageClient.Delete(r.Context(), remotePath); err != nil {
|
||||
errors.LogError(r, err, "Failed to delete from Nextcloud (continuing anyway)")
|
||||
}
|
||||
@@ -1314,7 +1315,8 @@ func downloadUserFileHandler(w http.ResponseWriter, r *http.Request, db *databas
|
||||
// Try to download from Nextcloud first
|
||||
if storageClient != nil {
|
||||
rel := strings.TrimPrefix(filePath, "/")
|
||||
remotePath := path.Join("/user", userID.String(), rel)
|
||||
// Keep remote user workspace path consistent with uploads: "/users/<userID>/<rel>"
|
||||
remotePath := path.Join("/users", userID.String(), rel)
|
||||
|
||||
reader, size, err := storageClient.Download(r.Context(), remotePath)
|
||||
if err == nil {
|
||||
|
||||
Reference in New Issue
Block a user