alittle splitted mstorectl code; etc

This commit is contained in:
2026-03-05 12:26:14 +02:00
parent 80d6a244cf
commit 223ae2e96e
24 changed files with 631 additions and 104 deletions
+37
View File
@@ -0,0 +1,37 @@
/*
* Copyright 2026 Oleg Borodin <onborodin@gmail.com>
*
* This work is published and licensed under a Creative Commons
* Attribution-NonCommercial-NoDerivatives 4.0 International License.
*
* Distribution of this work is permitted, but commercial use and
* modifications are strictly prohibited.
*/
package client
import (
"net/url"
"path"
"strings"
)
func repackServiceURI(fileuri string) (string, string, string, error) {
var err error
var res, username, password string
if !strings.Contains(fileuri, "://") {
fileuri = "https://" + fileuri
}
uri, err := url.Parse(fileuri)
if err != nil {
return res, username, password, err
}
uri.Path = path.Clean(uri.Path)
if uri.User != nil {
username = uri.User.Username()
password, _ = uri.User.Password()
}
uri.User = nil
//uri.Scheme = "https"
res = uri.String()
return res, username, password, err
}