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

XWikiAttachment#getContentInputStream() returns the content for the latest version if the content is not already loaded

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 7.0-rc-1
    • 7.0-milestone-2
    • Old Core
    • None
    • Unit
    • Easy
    • N/A
    • N/A

    Description

      If you have an attachment that has two versions, 1.1 and 1.2, where 1.1 corresponds to document version X and 1.2 to document version Y, then calling getContentInputStream() on the 1.1 version obtained from X will return the content from version 1.2.

      The reasons is this:

      • we store only the latest version of an attachment in xwikiattachment_content (where the content is identified by the file name and the document reference)
      • the rest of the versions are stored in xwikiattachment_archive
      • if the attachment content is not loaded or set then getContentInputStream() always loads the content from xwikiattachment_content (so the latest stored version).

      Attachments

        Issue Links

          Activity

            People

              mflorea Marius Dumitru Florea
              mflorea Marius Dumitru Florea
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: