Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-21324

Images for original object lost when editing copies

    Details

      Description

      When removing an archived version of a copy of an image object, the image file is removed from it's original location.

      Steps to reproduce:
      • Create and publish an image object
      • Edit the object once more, and publish without modifying the image.
        The files are stored in var/siteaccess/storage/images/ <original_path> /
      • Create a copy of the image object
        New files are created for the copy in var/siteaccess/storage/images/ <copy_path> /
      • On this copy, delete version 1 of the object (manage versions, check '1', remove selected)
        Note that the old version(s) may also be removed automatically when the maximum version history limit is reached.

      Looking at the first image path, the original file has been removed.

      Further details:

      When the object copy is created, only the ezimage attribute for the second version seems to be updated - version 1 still refers to the original object:

      version 2 (correct):

      <?xml version="1.0" encoding="utf-8"?>
      <ezimage serial_number="1" is_valid="1" filename="test_image.jpg" suffix="jpg" basename="test_image" 
      dirpath="var/ezflow_site/storage/images/copy/test_image/9994-1-eng-GB" ...
      

      version 1 (refers to the origin object):

      <?xml version="1.0" encoding="utf-8"?>
      <ezimage serial_number="1" is_valid="1" filename="test_image.jpg" suffix="jpg" basename="test_image" 
      dirpath="var/ezflow_site/storage/images/test_image/9994-1-eng-GB" ...
      

      Possible workaround:

      Modify [CopySettings]/VersionHandling in content.ini, from 'all' to 'last-published'.
      This way, there should be no reference of the original object's image in the new copy.

      [CopySettings]
      # Use either user-defined, last-published or all
      VersionHandling=last-published
      

        Issue Links

          Activity

          Hide
          Eduardo Fernandes (Inactive) added a comment -

          Temporary workaround for this issue

          By modifying the VersionHandling setting in content.ini(.append.php), it is possible to define that the new copy will contain only the last published version of the origin object.
          With this configuration, the issue will not be reproducible as there will be no history of the original image in this new object.

          [CopySettings]

          1. Use either user-defined, last-published or all
            VersionHandling=last-published
          Show
          Eduardo Fernandes (Inactive) added a comment - Temporary workaround for this issue By modifying the VersionHandling setting in content.ini(.append.php), it is possible to define that the new copy will contain only the last published version of the origin object. With this configuration, the issue will not be reproducible as there will be no history of the original image in this new object. [CopySettings] Use either user-defined, last-published or all VersionHandling=last-published
          Show
          Patrick Allaert (Inactive) added a comment - PR at: https://github.com/ezsystems/ezpublish-legacy/pull/762
          Show
          Patrick Allaert (Inactive) added a comment - Fixed in: eZ Publish master (merge commit): https://github.com/ezsystems/ezpublish-legacy/commit/0758b2537fa35ad4eb7918c0ac3d6b7b3f4dd36c eZ Publish master: https://github.com/ezsystems/ezpublish-legacy/commit/c851f713b63ea1d8a4bb32992255443e2f5307f6
          Hide
          Filipe Dobreira (Inactive) added a comment - - edited

          On master, I'm experiencing a database error attempting to edit the Image object, after applying the patch and the database changes:

          Timing:	Sep 30 2013 16:00:24
          Module start 'content'
          Error: eZMySQLiDB	Sep 30 2013 16:00:24
          Query error (1062): Duplicate entry '227-var/ezflow_site/storage/images/media/images/banana/227-1-eng' for key 'ezimagefile_co_attr_id_filepath'. Query: INSERT INTO ezimagefile (contentobject_attribute_id, filepath) VALUES(227, 'var/ezflow_site/storage/images/media/images/banana/227-1-eng-GB/Banana.jpg')
          Error: eZDBInterface::commit TRANSID-26a443c937cbd14db59e6a25de24d823	Sep 30 2013 16:00:24
          Transaction in progress failed due to DB error, transaction was rollbacked. Transaction ID is TRANSID-26a443c937cbd14db59e6a25de24d823.
          

          This happens regardless if I edit an existing image (before the changes) or a new one. Seems to be an issue with version handling, possibly?

          Show
          Filipe Dobreira (Inactive) added a comment - - edited On master, I'm experiencing a database error attempting to edit the Image object, after applying the patch and the database changes: Timing: Sep 30 2013 16:00:24 Module start 'content' Error: eZMySQLiDB Sep 30 2013 16:00:24 Query error (1062): Duplicate entry '227-var/ezflow_site/storage/images/media/images/banana/227-1-eng' for key 'ezimagefile_co_attr_id_filepath'. Query: INSERT INTO ezimagefile (contentobject_attribute_id, filepath) VALUES(227, 'var/ezflow_site/storage/images/media/images/banana/227-1-eng-GB/Banana.jpg') Error: eZDBInterface::commit TRANSID-26a443c937cbd14db59e6a25de24d823 Sep 30 2013 16:00:24 Transaction in progress failed due to DB error, transaction was rollbacked. Transaction ID is TRANSID-26a443c937cbd14db59e6a25de24d823. This happens regardless if I edit an existing image (before the changes) or a new one. Seems to be an issue with version handling, possibly?
          Hide
          Bertrand Dunogier added a comment -
          Show
          Bertrand Dunogier added a comment - Reverted in ezpublish-legacy/master: https://github.com/ezsystems/ezpublish-legacy/commit/18bcf8e
          Show
          Bertrand Dunogier added a comment - Pull request: https://github.com/ezsystems/ezpublish-legacy/pull/792 .
          Hide
          Bertrand Dunogier added a comment -

          Added a much more simple PR that should still fix the issue: https://github.com/ezsystems/ezpublish-legacy/pull/825.

          Show
          Bertrand Dunogier added a comment - Added a much more simple PR that should still fix the issue: https://github.com/ezsystems/ezpublish-legacy/pull/825 .
          Hide
          Bertrand Dunogier added a comment -

          Merged #825 in c883937.

          Tests are in a separate commit: c883937.

          Show
          Bertrand Dunogier added a comment - Merged #825 in c883937 . Tests are in a separate commit: c883937 .
          Hide
          Joao Pingo (Inactive) added a comment -

          QA Approved

          Show
          Joao Pingo (Inactive) added a comment - QA Approved

            People

            • Assignee:
              Unassigned
              Reporter:
              Eduardo Fernandes (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              16 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 week, 4 days, 4 hours, 19 minutes
                1w 4d 4h 19m