Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-5506

DELETE on attachments doesn't work correctly

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 2.5 M2
    • 2.5 M1
    • REST
    • None
    • Integration
    • Unknown

    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

      Attachments

        Activity

          People

            fmancinelli Fabio Mancinelli
            fmancinelli Fabio Mancinelli
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: