mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-10 04:05:42 +01: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 2015 The Gogs Authors. All rights reserved.
|
||||||
// Copyright 2016 The Gitea Authors. All rights reserved.
|
// Copyright 2016 The Gitea Authors. All rights reserved.
|
||||||
|
// Copyright 2023 The forgejo Authors. All rights reserved.
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
// Package v1 Gitea API
|
// Package v1 Gitea API
|
||||||
|
@ -900,7 +901,7 @@ func Routes() *web.Route {
|
||||||
m.Post("/inbox", // ToDo: Post or Put?
|
m.Post("/inbox", // ToDo: Post or Put?
|
||||||
// TODO: bind ativities here
|
// TODO: bind ativities here
|
||||||
bind(forgefed.Star{}),
|
bind(forgefed.Star{}),
|
||||||
//activitypub.ReqHTTPSignature(),
|
// TODO: activitypub.ReqHTTPSignature(),
|
||||||
activitypub.RepositoryInbox)
|
activitypub.RepositoryInbox)
|
||||||
}, context_service.RepositoryIDAssignmentAPI())
|
}, context_service.RepositoryIDAssignmentAPI())
|
||||||
}, tokenRequiresScopes(auth_model.AccessTokenScopeCategoryActivityPub))
|
}, 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
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
package utils
|
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)
|
// 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
|
// Thanks to https://www.socketloop.com/tutorials/golang-characters-limiter-example
|
||||||
func CharLimiter(s string, limit int) string {
|
func CharLimiter(s string, limit int) string {
|
||||||
|
|
||||||
reader := strings.NewReader(s)
|
reader := strings.NewReader(s)
|
||||||
|
|
||||||
buff := make([]byte, limit)
|
buff := make([]byte, limit)
|
||||||
|
|
||||||
n, _ := io.ReadAtLeast(reader, buff, limit)
|
n, _ := io.ReadAtLeast(reader, buff, limit)
|
||||||
|
|
||||||
if n != 0 {
|
if n != 0 {
|
||||||
return fmt.Sprint(string(buff), "...")
|
return fmt.Sprint(string(buff), "...")
|
||||||
} else {
|
|
||||||
return s
|
|
||||||
}
|
}
|
||||||
|
return s
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue