diff --git a/cmd/dkl-local-server/ws-download-set.go b/cmd/dkl-local-server/ws-download-set.go index 3cd60c6..6a2d02b 100644 --- a/cmd/dkl-local-server/ws-download-set.go +++ b/cmd/dkl-local-server/ws-download-set.go @@ -6,6 +6,7 @@ import ( "encoding/base32" "fmt" "io" + "path/filepath" "slices" "strconv" "strings" @@ -76,7 +77,15 @@ type DownloadSetItem struct { } func (i DownloadSetItem) EncodeTo(buf *strings.Builder) { - buf.WriteString(i.Kind) + kind := i.Kind + switch kind { + case "host": + kind = "h" + case "cluster": + kind = "c" + } + + buf.WriteString(kind) buf.WriteByte(':') buf.WriteString(i.Name) @@ -89,6 +98,14 @@ func (i DownloadSetItem) EncodeTo(buf *strings.Builder) { func (i *DownloadSetItem) Decode(encoded string) { rem := encoded i.Kind, rem, _ = strings.Cut(rem, ":") + + switch i.Kind { + case "h": + i.Kind = "host" + case "c": + i.Kind = "cluster" + } + i.Name, rem, _ = strings.Cut(rem, ":") if rem == "" { @@ -230,10 +247,8 @@ func wsDownloadSet(req *restful.Request, resp *restful.Response) { ` + err.Error() + ` - + + + +