Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Critical bug: Attachments were accidentally deleted #4210

Closed
2 of 7 tasks
yasuokav opened this issue Jun 10, 2018 · 0 comments · Fixed by #4216
Closed
2 of 7 tasks

Critical bug: Attachments were accidentally deleted #4210

yasuokav opened this issue Jun 10, 2018 · 0 comments · Fixed by #4216
Labels
issue/critical This issue should be fixed ASAP. If it is a PR, the PR should be merged ASAP type/bug
Milestone

Comments

@yasuokav
Copy link
Contributor

yasuokav commented 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

if _, err = sess.In("issue_id", issueIDs).Delete(&Comment{}); err != nil {

c.ID == 0 here

func (c *Comment) AfterDelete() {
_, err := DeleteAttachmentsByComment(c.ID, true)
if err != nil {
log.Info("Could not delete files for comment %d on issue #%d: %s", c.ID, c.IssueID, err)
}
}

Screenshots

N/A

@lunny lunny added type/bug issue/critical This issue should be fixed ASAP. If it is a PR, the PR should be merged ASAP labels Jun 11, 2018
@lunny lunny added this to the 1.5.0 milestone Jun 11, 2018
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/critical This issue should be fixed ASAP. If it is a PR, the PR should be merged ASAP type/bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants