fix storage pool, datasets,volume and disk
Some checks failed
CI / test-build (push) Has been cancelled

This commit is contained in:
2025-12-20 02:18:51 +00:00
parent 8029bcfa15
commit 98bedf6487
333 changed files with 352 additions and 64 deletions

View File

@@ -2,6 +2,7 @@ package httpapp
import (
"net/http"
"net/url"
"strings"
"gitea.avt.data-center.id/othman.suseno/atlas/internal/errors"
@@ -58,6 +59,22 @@ func pathParam(r *http.Request, prefix string) string {
return ""
}
// pathParamFull extracts the full path after prefix (for dataset/zvol names that may contain slashes)
func pathParamFull(r *http.Request, prefix string) string {
path := strings.TrimPrefix(r.URL.Path, prefix)
path = strings.Trim(path, "/")
if path == "" {
return ""
}
// URL decode the path
decoded, err := url.PathUnescape(path)
if err != nil {
// If decoding fails, return original path
return path
}
return decoded
}
// handlePoolOps routes pool operations by method
func (a *App) handlePoolOps(w http.ResponseWriter, r *http.Request) {
// Extract pool name from path like /api/v1/pools/tank