Release Attachment Deletion from Disk Help


When I delete an attachment from a release (using the web interface), it doesn’t appear to be deleted from disk. I assumed this would be the intended behavior but I could be missing something of course.

I’ve tested this by uploading the same attachment several times and subsequently deleting it. I then compare the checksum of the attachments on disk to the known checksum of the file, which shows the same file saved several times even though it was deleted each time.

If this is a bug I’m happy to assist with troubleshooting the issue. If this is the intended behavior, i.e., attachments are not deleted from disk when deleted from a release, it would be useful to have a procedure to delete orphaned attachments as an alternative; perhaps in the Operations box in the Admin Panel?

Thanks in advance for your help on this!

Build Information

  • Gogs Version: (binary release)
  • Database: sqlite3
  • System: Ubuntu Server Linux 16.04.4 (Xenial) LTS


Hi, I can’t recall exactly, but the simple rule is once uploaded, never delete.


Okay, that’s fair; thanks for the response. I’ll look at creating something for myself if the storage space ever becomes a significant issue.

Thanks for all your hard work on this!


If you have to delete, you can scan attachment table can locate ones do not have record in table. But that table includes all attachments for other purpose like issues, comments.