Critical bug: Attachments were accidentally deleted #1914

Closed
opened 2025-11-02 04:17:43 -06:00 by GiteaMirror · 0 comments
Owner

Originally created by @ghost on GitHub (Jun 10, 2018).

  • Gitea version (or commit ref): 1.4.2 / af57d6a
  • Git version: N/A
  • Operating system: N/A
  • Database:
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist: N/A

Description

Steps to Reproduce

  1. Create repository: "Repo1"
  2. Create an issue and upload some attachments
    (https://try.gitea.io allow image/jpeg|image/png|application/zip|application/gzip)
  3. Create repository: "Repo2"
  4. Create an issue in "Repo2"
  5. Delete "Repo2"
  6. Any attachments uploaded to issue/release/PR were accidentally deleted from database and disk, no matter which user uploaded the files (Attachments uploaded to comment are not affected)

I think it's caused by #1092

af57d6ab8a/models/repo.go (L1845)

c.ID == 0 here
af57d6ab8a/models/issue_comment.go (L149-L155)

Screenshots

N/A

Originally created by @ghost on GitHub (Jun 10, 2018). - Gitea version (or commit ref): 1.4.2 / af57d6a - Git version: N/A - Operating system: N/A - Database: - [ ] PostgreSQL - [ ] MySQL - [ ] MSSQL - [x] SQLite - Can you reproduce the bug at https://try.gitea.io: - [x] Yes ~~(provide example URL)~~ - [ ] No - [ ] Not relevant - Log gist: N/A ## Description Steps to Reproduce 1. Create repository: "Repo1" 2. Create an issue and upload some attachments (<https://try.gitea.io> allow `image/jpeg|image/png|application/zip|application/gzip`) 3. Create repository: "Repo2" 4. Create an issue in "Repo2" 5. Delete "Repo2" 6. Any attachments uploaded to issue/release/PR were accidentally deleted from database and disk, no matter which user uploaded the files (Attachments uploaded to comment are not affected) I think it's caused by #1092 https://github.com/go-gitea/gitea/blob/af57d6ab8a5a1f0f8bb3f52a081736c8c57cbd72/models/repo.go#L1845 `c.ID == 0` here https://github.com/go-gitea/gitea/blob/af57d6ab8a5a1f0f8bb3f52a081736c8c57cbd72/models/issue_comment.go#L149-L155 ## Screenshots N/A
GiteaMirror added the issue/criticaltype/bug labels 2025-11-02 04:17:43 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#1914