Description
A DELETE request on an attachment doesn't remove it correctly. An exception is generated if the attachment is retrieved after it has been deleted (which gives a 500 response) instead of a 404 response.
Steps to reproduce:
1) curl -u "Admin:admin" -X PUT --data-ascii "CONTENT" -H "Content-type: text/plain" http://localhost:8080/xwiki/rest/wikis/xwiki/spaces/Main/pages/WebHome/attachments/foo.txt
2) curl http://localhost:8080/xwiki/rest/wikis/xwiki/spaces/Main/pages/WebHome/attachments/foo.txt
3) curl -u "Admin:admin" -X "DELETE" http://localhost:8080/xwiki/rest/wikis/xwiki/spaces/Main/pages/WebHome/attachments/foo.txt
4) curl http://localhost:8080/xwiki/rest/wikis/xwiki/spaces/Main/pages/WebHome/attachments/foo.txt
HTTP/1.1 500 Server Error
Error number 3231 in 3: Exception while loading attachment foo.txt of document Main.WebHome
Wrapped Exception: No row with the given identifier exists: com.xpn.xwiki.doc.XWikiAttachmentContent#-2087434409