]> source.dussan.org Git - gitea.git/commit
Only serve attachments when linked to issue/release and if accessible by user (#9340)
authorAntoine GIRARD <sapk@users.noreply.github.com>
Sat, 4 Jan 2020 23:20:08 +0000 (00:20 +0100)
committerLauris BH <lauris@nix.lv>
Sat, 4 Jan 2020 23:20:08 +0000 (01:20 +0200)
commit8b2407371365fc123fc368bfd46b15f55ba8ae6a
tree8f112acce97c863846a88a6b37e3b570062860d2
parent6a5a2f493a2b8d19a9f6196bd208a3b8a14e9c1c
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
integrations/attachement_test.go [deleted file]
integrations/attachment_test.go [new file with mode: 0644]
models/attachment.go
models/attachment_test.go
models/fixtures/attachment.yml
models/fixtures/release.yml
models/fixtures/repo_unit.yml
routers/repo/attachment.go
routers/routes/routes.go
routers/user/home_test.go