fix: Also substitute COPYRIGHT HOLDER and the organization in BSD 4-Clause license (#6942)

Fixes #6864

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6942
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: Beowulf <beowulf@beocode.eu>
Co-committed-by: Beowulf <beowulf@beocode.eu>
This commit is contained in:
Beowulf 2025-02-15 12:55:59 +00:00 committed by Gusted
parent 486acb04fa
commit 7104c73c96
2 changed files with 30 additions and 0 deletions

View file

@ -1,4 +1,5 @@
// Copyright 2023 The Gitea Authors. All rights reserved.
// Copyright 2025 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package repository
@ -107,6 +108,9 @@ func getLicensePlaceholder(name string) *licensePlaceholder {
}
// Other special placeholders can be added here.
} else if name == "BSD-4-Clause" {
ret.Owner = append(ret.Owner, "COPYRIGHT HOLDER")
ret.Owner = append(ret.Owner, "the organization")
}
return ret
}

View file

@ -1,4 +1,5 @@
// Copyright 2023 The Gitea Authors. All rights reserved.
// Copyright 2025 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package repository
@ -170,6 +171,31 @@ Copyright (C) 2023 by Gitea teabot@gitea.io
...
... THE AUTHOR BE LIABLE FOR ...
`,
},
{
name: "BSD-4-Clause",
args: args{
name: "BSD-4-Clause",
values: &LicenseValues{Year: "2025", Owner: "Forgejo", Email: "hello@forgejo.org", Repo: "forgejo"},
origin: `
Copyright (c) <year> <owner>. All rights reserved.
... includes software developed by the organization.
... Neither the name of the copyright holder nor
... PROVIDED BY COPYRIGHT HOLDER "AS IS" ... NO EVENT SHALL COPYRIGHT HOLDER BE LIABLE ...
`,
},
want: `
Copyright (c) 2025 Forgejo. All rights reserved.
... includes software developed by Forgejo.
... Neither the name of the copyright holder nor
... PROVIDED BY Forgejo "AS IS" ... NO EVENT SHALL Forgejo BE LIABLE ...
`,
},
}