mirror of
https://github.com/psviderski/uncloud.git
synced 2026-10-06 13:18:58 +00:00
fix parse token, return out in cmdexec run
This commit is contained in:
1 parent
cfa2105684
commit
f49e91b41f
2 files changed
+5
-8
No files matched your search
@@ -29,8 +29,8 @@ func NewToken(publicKey secret.Secret, endpoints []netip.AddrPort) Token {
|
||||
|
||||
// ParseToken decodes a machine token from the given string.
|
||||
func ParseToken(s string) (Token, error) {
|
||||
if strings.HasPrefix(s, TokenPrefix) {
|
||||
return Token{}, fmt.Errorf("invalid token prefix")
|
||||
if !strings.HasPrefix(s, TokenPrefix) {
|
||||
return Token{}, fmt.Errorf("invalid token prefix: %s", s)
|
||||
}
|
||||
decoded, err := base64.StdEncoding.DecodeString(s[len(TokenPrefix):])
|
||||
if err != nil {
|
||||
|
||||
Reference in new issue
Block a user