Skip to content

Commit 26c06a3

Browse files
committed
improve
1 parent b460e0d commit 26c06a3

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

modules/packages/arch/metadata.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
"strings"
1616
"sync"
1717

18+
"code.gitea.io/gitea/modules/log"
1819
"code.gitea.io/gitea/modules/packages"
1920
"code.gitea.io/gitea/modules/util"
2021
"code.gitea.io/gitea/modules/validation"
@@ -282,7 +283,13 @@ func ParsePackageInfo(compressType string, r io.Reader) (*Package, error) {
282283
}
283284
}
284285

285-
return p, errors.Join(scanner.Err(), ValidatePackageSpec(p))
286+
validateErr := ValidatePackageSpec(p)
287+
if validateErr != nil {
288+
// Do not the validation err as fatal error, otherwise if the spec changes we must keep this in sync.
289+
// It is the responsibility of the client to check these when installing a package but for the registry it's less relevant.
290+
log.Error("Error validating arch package spec: %v", validateErr)
291+
}
292+
return p, scanner.Err()
286293
}
287294

288295
// ValidatePackageSpec Arch package validation according to PKGBUILD specification.

tests/integration/api_packages_arch_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func TestPackageArch(t *testing.T) {
3535
defer tests.PrepareTestEnv(t)()
3636
user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2})
3737
unpack := func(s string) []byte {
38-
data, _ := base64.StdEncoding.DecodeString(strings.ReplaceAll(strings.ReplaceAll(strings.TrimSpace(s), "\n", ""), "\r", ""))
38+
data, _ := base64.StdEncoding.DecodeString(s)
3939
return data
4040
}
4141
rootURL := fmt.Sprintf("/api/packages/%s/arch", user.Name)

0 commit comments

Comments
 (0)