working commit

This commit is contained in:
2026-03-10 12:52:12 +02:00
parent d0a5fab362
commit d1ef1fbe50
42 changed files with 242 additions and 426 deletions
-34
View File
@@ -1,34 +0,0 @@
/*
* 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 accountcmd
import (
"net/url"
"path"
"strings"
)
func packUserinfo(resurseuri, username, password string) (string, error) {
var err error
var res string
if !strings.Contains(resurseuri, "://") {
resurseuri = "https://" + resurseuri
}
uri, err := url.Parse(resurseuri)
if err != nil {
return res, err
}
uri.Path = path.Clean(uri.Path)
if username != "" && password != "" {
uri.User = url.UserPassword(username, password)
}
res = uri.String()
return res, err
}