mirror of
https://github.com/go-gitea/gitea.git
synced 2025-02-02 15:09:33 -05:00
Update
This commit is contained in:
parent
35a2b9b3a5
commit
b99fe1cf79
@ -237,7 +237,7 @@ func runServ(c *cli.Context) error {
|
||||
// for AGit Flow
|
||||
if cmd == "ssh_info" {
|
||||
data := private.GetSSHInfo(ctx)
|
||||
fmt.Print(data)
|
||||
fmt.Println(data)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
)
|
||||
|
||||
@ -43,16 +44,19 @@ func GetSSHInfo(ctx context.Context) string {
|
||||
|
||||
resp, err := req.Response()
|
||||
if err != nil {
|
||||
log.Error("GetSSHInfo Error: %v", err)
|
||||
return ""
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
log.Error("response status code is not OK, code: %d", resp.StatusCode)
|
||||
return ""
|
||||
}
|
||||
|
||||
content, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
log.Error("read body error: %v", err)
|
||||
return ""
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user