From 7d78fb8adcccc02b84e23ff3948b57493fb9eb28 Mon Sep 17 00:00:00 2001 From: Michael Jerger Date: Fri, 22 Dec 2023 14:47:34 +0100 Subject: [PATCH] adjust to ugly linting --- routers/api/v1/api.go | 3 ++- routers/utils/utils.go | 9 ++------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go index 3ef5d89b86..a844261c35 100644 --- a/routers/api/v1/api.go +++ b/routers/api/v1/api.go @@ -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)) diff --git a/routers/utils/utils.go b/routers/utils/utils.go index 56f7aa2215..1f226486d0 100644 --- a/routers/utils/utils.go +++ b/routers/utils/utils.go @@ -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 }