diff --git a/go_cloud/internal/http/routes.go b/go_cloud/internal/http/routes.go index 8e81a7c..c39b3a5 100644 --- a/go_cloud/internal/http/routes.go +++ b/go_cloud/internal/http/routes.go @@ -8,7 +8,6 @@ import ( "mime/multipart" "net/http" "net/url" - "os" "path" "path/filepath" "strings" @@ -1063,12 +1062,12 @@ func createOrgFileHandler(w http.ResponseWriter, r *http.Request, db *database.D storedPath = "/" + storedPath } written := int64(len(data)) - + if storageClient == nil { errors.WriteError(w, errors.CodeInternal, "Storage not configured", http.StatusInternalServerError) return } - + // Build remote path under /orgs/ rel := strings.TrimPrefix(storedPath, "/") remotePath := path.Join("/orgs", orgID.String(), rel) @@ -1213,13 +1212,13 @@ func createUserFileHandler(w http.ResponseWriter, r *http.Request, db *database. } written := int64(len(data)) fmt.Printf("[DEBUG] Upload: user=%s, file=%s, size=%d, path=%s\n", userID.String(), header.Filename, len(data), storedPath) - + // ONLY use Nextcloud WebDAV storage if storageClient == nil { errors.WriteError(w, errors.CodeInternal, "Storage not configured", http.StatusInternalServerError) return } - + rel := strings.TrimPrefix(storedPath, "/") remotePath := path.Join("/users", userID.String(), rel) fmt.Printf("[DEBUG] Uploading to WebDAV: %s\n", remotePath) @@ -1339,7 +1338,7 @@ func downloadOrgFileHandler(w http.ResponseWriter, r *http.Request, db *database errors.WriteError(w, errors.CodeInternal, "Storage not configured", http.StatusInternalServerError) return } - + rel := strings.TrimPrefix(filePath, "/") remotePath := path.Join("/orgs", orgID.String(), rel) @@ -1396,7 +1395,7 @@ func downloadUserFileHandler(w http.ResponseWriter, r *http.Request, db *databas errors.WriteError(w, errors.CodeInternal, "Storage not configured", http.StatusInternalServerError) return } - + rel := strings.TrimPrefix(filePath, "/") // Keep remote user workspace path consistent with uploads: "/users//" remotePath := path.Join("/users", userID.String(), rel)