mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-24 22:35:39 +03:00
adjust to ugly linting
This commit is contained in:
parent
a64ce2feb1
commit
7d78fb8adc
2 changed files with 4 additions and 8 deletions
|
@ -1,5 +1,6 @@
|
|||
// Copyright 2015 The Gogs Authors. All rights reserved.
|
||||
// Copyright 2016 The Gitea Authors. All rights reserved.
|
||||
// Copyright 2023 The forgejo Authors. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
// Package v1 Gitea API
|
||||
|
@ -900,7 +901,7 @@ func Routes() *web.Route {
|
|||
m.Post("/inbox", // ToDo: Post or Put?
|
||||
// TODO: bind ativities here
|
||||
bind(forgefed.Star{}),
|
||||
//activitypub.ReqHTTPSignature(),
|
||||
// TODO: activitypub.ReqHTTPSignature(),
|
||||
activitypub.RepositoryInbox)
|
||||
}, context_service.RepositoryIDAssignmentAPI())
|
||||
}, tokenRequiresScopes(auth_model.AccessTokenScopeCategoryActivityPub))
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2017 The Gitea Authors. All rights reserved.
|
||||
// Copyright 2017, 2023 The Gitea & forgejo Authors. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
package utils
|
||||
|
@ -34,16 +34,11 @@ func IsExternalURL(rawURL string) bool {
|
|||
// Limit number of characters in a string (useful to prevent log injection attacks and overly long log outputs)
|
||||
// Thanks to https://www.socketloop.com/tutorials/golang-characters-limiter-example
|
||||
func CharLimiter(s string, limit int) string {
|
||||
|
||||
reader := strings.NewReader(s)
|
||||
|
||||
buff := make([]byte, limit)
|
||||
|
||||
n, _ := io.ReadAtLeast(reader, buff, limit)
|
||||
|
||||
if n != 0 {
|
||||
return fmt.Sprint(string(buff), "...")
|
||||
} else {
|
||||
return s
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue