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

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 7.0-milestone-2
    • Fix Version/s: 7.0-rc-1
    • Component/s: Old Core
    • Labels:
      None
    • Tests:
      Unit
    • Difficulty:
      Easy
    • Documentation:
      N/A
    • Documentation in Release Notes:
      N/A
    • Similar issues:

      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

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

                Dates

                • Created:
                  Updated:
                  Resolved: