Refering to:
There is no delete mechanism at all for attachments.
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.
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.
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
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.
Most helpful comment
The user should be presented with the option to delete any / all previously added attachments while editing a release.