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

The attachments table can return a broken row and log errors when an attachment is added while it is being refreshed

    XMLWordPrintable

Details

    • Unknown

    Description

      Steps to reproduce

      1. Open the Attachments tab of a page
      2. Upload several files at once (or have someone else add an attachment to the page) so that an attachment is saved while the attachments table is being refreshed

      Expected

      The attachments table lists the attachments correctly and nothing is logged.

      Actual

      The refresh of the attachments table can return a broken row (empty file name, size, date, author, actions), and the following errors are logged:

      ERROR o.a.v.rendering - Left side ($sz) of comparison operation has null value at <unknown template>[line 1402, column 10]
      ERROR o.a.v.rendering - Left side ($ksz) of comparison operation has null value at <unknown template>[line 1407, column 11]
      

      Cause

      flamingo/attachmentsjson.vm lists the attachments of the page with a query on the database, then builds each row from $doc.getAttachment($attachmentReference.name), $doc being the document loaded at the beginning of the request. An attachment saved in between is returned by the query but not found in $doc, so the row is built from a null attachment, and #dynamicsize (from macros.vm) is called with a null size.

      This is visible on CI with LightboxIT#playSlideshow (image-lightbox functional tests), which uploads two images in a row through the attachments pane.

      Attachments

        Issue Links

          Activity

            People

              surli Simon Urli
              surli Simon Urli
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated: