mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-31 20:02:09 +00:00
fix: disallow blame on directories (#6716)
- Don't allow the blame operation on directories. - Added integration test. - Resolves forgejo/forgejo#6533 Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6716 Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org> Co-authored-by: Gusted <postmaster@gusted.xyz> Co-committed-by: Gusted <postmaster@gusted.xyz>
This commit is contained in:
parent
b69755b417
commit
fd285bfc4e
2 changed files with 17 additions and 0 deletions
|
@ -1462,3 +1462,15 @@ func TestRepoSubmoduleView(t *testing.T) {
|
|||
htmlDoc.AssertElement(t, fmt.Sprintf(`tr[data-entryname="repo1"] a[href="%s"]`, u.JoinPath("/user2/repo1").String()), true)
|
||||
})
|
||||
}
|
||||
|
||||
func TestBlameDirectory(t *testing.T) {
|
||||
defer tests.PrepareTestEnv(t)()
|
||||
|
||||
// Ensure directory exists.
|
||||
req := NewRequest(t, "GET", "/user2/repo59/src/branch/master/deep")
|
||||
MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
// Blame is not allowed
|
||||
req = NewRequest(t, "GET", "/user2/repo59/blame/branch/master/deep")
|
||||
MakeRequest(t, req, http.StatusNotFound)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue