Gitea: There is no delete mechanism for attachments

Created on 15 Jan 2017  路  12Comments  路  Source: go-gitea/gitea

Refering to:

  • Gitea version (or commit ref): v1.0.0-126-g302fa42
  • Feature Request.

There is no delete mechanism at all for attachments.

  • [ ] The user should be presented with the option to delete any / all attachments from an issue comment.
  • [x] Attachments should be deleted immediately when an issue / issue comment are deleted.
  • [x] Attachments should be deleted immediately when a release is deleted
  • [ ] "Orphaned"Attachments should be deleted periodically (eg: cron job). Orphaned attachments have both attachment.CommentID and attachment.ReleaseId of 0. They occur when a user starts creating an issue, uploads an attachment and then closes the browser without submitting.

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

kinenhancement revieweconfirmed

Most helpful comment

The user should be presented with the option to delete any / all previously added attachments while editing a release.

All 12 comments

Also when a release is removed? (since that is now a thing 馃槃 #673 )

Actually it looks like the code tries to delete an attachment on deleting a comment.

See Here

However it doesn't manage to do so.

Okay so this doesn't trigger the AfterDelete(). I guess that's an xorm bug. I think for the time being I'm going to work around it and explicitly Delete the attachment in DeleteCommentById

change this to below code, then AfterDelete() will work.

if _, err = sess.Delete(&Comment{
ID: comment.ID,
}); err != nil {
        return err
    }

@lunny I will take it.

@lunny we need to merge this XORM PR first https://github.com/go-xorm/xorm/pull/525

704 also fix item two.

Attachments should be deleted immediately when an issue / issue comment or release are deleted.

cc @couling

These aren't all fixed.

The user should be presented with the option to delete any / all previously added attachments while editing a release.

@gmastergreatee You are right! In addition to that, you cannot delete and recreate a release because it also deletes the git tag. One should split this.

As an additional issue, the attachments remain on disk even after deleting the release itself (see #2618).

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

flozz picture flozz  路  3Comments

adpande picture adpande  路  3Comments

BRMateus2 picture BRMateus2  路  3Comments

cookiengineer picture cookiengineer  路  3Comments

kolargol picture kolargol  路  3Comments