mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Only serve attachments when linked to issue/release and if accessible by user (#9340)
* test: add current attachement responses * refactor: check if attachement is linked and accessible by user * chore: clean TODO * fix: typo attachement -> attachment * revert un-needed go.sum change * refactor: move models logic to models * fix TestCreateIssueAttachment which was wrongly successful * fix unit tests with unittype added * fix unit tests with changes * use a valid uuid format for pgsql int. test * test: add unit test TestLinkedRepository * refactor: allow uploader to access unlinked attachement * add missing blank line * refactor: move to a separate function repo.GetAttachment * typo * test: remove err test return * refactor: use repo perm for access checking generally + 404 for all reject
This commit is contained in:
committed by
Lauris BH
parent
6a5a2f493a
commit
8b24073713
@@ -10,7 +10,7 @@
|
||||
-
|
||||
id: 2
|
||||
uuid: a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a12
|
||||
issue_id: 1
|
||||
issue_id: 4
|
||||
comment_id: 0
|
||||
name: attach2
|
||||
download_count: 1
|
||||
@@ -81,6 +81,15 @@
|
||||
-
|
||||
id: 10
|
||||
uuid: a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a20
|
||||
uploader_id: 8
|
||||
name: attach1
|
||||
download_count: 0
|
||||
created_unix: 946684800
|
||||
created_unix: 946684800
|
||||
|
||||
-
|
||||
id: 11
|
||||
uuid: a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a21
|
||||
release_id: 2
|
||||
name: attach1
|
||||
download_count: 0
|
||||
created_unix: 946684800
|
||||
|
@@ -11,4 +11,19 @@
|
||||
is_draft: false
|
||||
is_prerelease: false
|
||||
is_tag: false
|
||||
created_unix: 946684800
|
||||
created_unix: 946684800
|
||||
|
||||
-
|
||||
id: 2
|
||||
repo_id: 40
|
||||
publisher_id: 2
|
||||
tag_name: "v1.1"
|
||||
lower_tag_name: "v1.1"
|
||||
target: "master"
|
||||
title: "testing-release"
|
||||
sha1: "65f1bf27bc3bf70f64657658635e66094edbcb4d"
|
||||
num_commits: 10
|
||||
is_draft: false
|
||||
is_prerelease: false
|
||||
is_tag: false
|
||||
created_unix: 946684800
|
||||
|
@@ -472,4 +472,10 @@
|
||||
repo_id: 48
|
||||
type: 7
|
||||
config: "{\"ExternalTrackerURL\":\"https://tracker.com\",\"ExternalTrackerFormat\":\"https://tracker.com/{user}/{repo}/issues/{index}\",\"ExternalTrackerStyle\":\"alphanumeric\"}"
|
||||
created_unix: 946684810
|
||||
-
|
||||
id: 69
|
||||
repo_id: 2
|
||||
type: 2
|
||||
config: "{}"
|
||||
created_unix: 946684810
|
Reference in New Issue
Block a user