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

Unable to publish an image content with the REST API

    Details

      Description

      (bug found during the workshop at the Summer Camp)

      Using the REST API, it seems like it's currently impossible to publish an Image content. After creating the draft, the publish operation ends with an HTTP 406 error... Doing the same without filling the ezimage field is working as expected.

      Steps to reproduce:

      $ curl -u "admin:ezpublish" -i -H "Accept: application/xml" -H "Content-Type: application/vnd.ez.api.ContentCreate+json" -X POST -d @createimage.json http://ezpublish5.loc/api/ezp/v2/content/objects
       
      HTTP/1.1 201 Created
      Date: Mon, 09 Sep 2013 06:12:29 GMT
      Server: Apache/2.2.22 (Ubuntu)
      X-Powered-By: PHP/5.3.10-1ubuntu3.7
      Accept-Patch: application/vnd.ez.api.ContentUpdate+xml
      Location: /api/ezp/v2/content/objects/126
      Status: 201 Created
      Cache-Control: no-cache
      X-Debug-Token: 144dd0
      Transfer-Encoding: chunked
      Content-Type: application/vnd.ez.api.ContentInfo+xml
       
      <?xml version="1.0" encoding="UTF-8"?>
      <Content media-type="application/vnd.ez.api.ContentInfo+xml" href="/api/ezp/v2/content/objects/126" remoteId="8caededb49509f7c559b5f9bb7e69a16" id="126">
       <ContentType media-type="application/vnd.ez.api.ContentType+xml" href="/api/ezp/v2/content/types/27"/>
       <Name>eZ Systems logo created with the REST API</Name>
       <Versions media-type="application/vnd.ez.api.VersionList+xml" href="/api/ezp/v2/content/objects/126/versions"/>
       <CurrentVersion media-type="application/vnd.ez.api.Version+xml" href="/api/ezp/v2/content/objects/126/currentversion"/>
       <Section media-type="application/vnd.ez.api.Section+xml" href="/api/ezp/v2/content/sections/3"/>
       <Locations media-type="application/vnd.ez.api.LocationList+xml" href="/api/ezp/v2/content/objects/126/locations"/>
       <Owner media-type="application/vnd.ez.api.User+xml" href="/api/ezp/v2/user/users/14"/>
       <mainLanguageCode>eng-GB</mainLanguageCode>
       <alwaysAvailable>false</alwaysAvailable>
      </Content>
       
      $ curl -i -u "admin:ezpublish" -X PUBLISH http://ezpublish5.loc/api/ezp/v2/content/objects/126/versions/1
      HTTP/1.1 406 Not Acceptable
      Date: Mon, 09 Sep 2013 06:13:15 GMT
      Server: Apache/2.2.22 (Ubuntu)
      X-Powered-By: PHP/5.3.10-1ubuntu3.7
      Status: 406 Not Acceptable
      Cache-Control: no-cache
      X-Debug-Token: e7de0a
      Transfer-Encoding: chunked
      Content-Type: application/vnd.ez.api.ErrorMessage+xml
       
      <?xml version="1.0" encoding="UTF-8"?>
      <ErrorMessage media-type="application/vnd.ez.api.ErrorMessage+xml">
       <errorCode>406</errorCode>
       <errorMessage>Not Acceptable</errorMessage>
       <errorDescription>Argument '$path' is invalid: Storage directory 'var/ezdemo_site/storage' not found in /var/ezdemo_site/storage/images/698-1-eng-GB/ez-logo.gif</errorDescription>
       <trace>#0 /home/dp/dev/ezpublish5/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/IO/Handler/Legacy.php(397): eZ\Publish\Core\IO\Handler\Legacy-&gt;removeStoragePath('/var/ezdemo_sit...')
      #1 /home/dp/dev/ezpublish5/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/IO/IOService.php(256): eZ\Publish\Core\IO\Handler\Legacy-&gt;getExternalPath('/var/ezdemo_sit...')
      #2 /home/dp/dev/ezpublish5/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/FieldType/Image/ImageStorage.php(206): eZ\Publish\Core\IO\IOService-&gt;getExternalPath('/var/ezdemo_sit...')
      #3 /home/dp/dev/ezpublish5/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/Persistence/Legacy/Content/StorageHandler.php(95): eZ\Publish\Core\FieldType\Image\ImageStorage-&gt;getFieldData(Object(eZ\Publish\SPI\Persistence\Content\VersionInfo), Object(eZ\Publish\SPI\Persistence\Content\Field), Array)
      #4 /home/dp/dev/ezpublish5/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/Persistence/Legacy/Content/FieldHandler.php(379): eZ\Publish\Core\Persistence\Legacy\Content\StorageHandler-&gt;getFieldData(Object(eZ\Publish\SPI\Persistence\Content\VersionInfo), Object(eZ\Publish\SPI\Persistence\Content\Field))
      #5 /home/dp/dev/ezpublish5/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/Persistence/Legacy/Content/Handler.php(323): eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler-&gt;loadExternalFieldData(Object(eZ\Publish\SPI\Persistence\Content))
      #6 /home/dp/dev/ezpublish5/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/Persistence/Cache/ContentHandler.php(72): eZ\Publish\Core\Persistence\Legacy\Content\Handler-&gt;load(126, 1)
      #7 /home/dp/dev/ezpublish5/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/Repository/ContentService.php(361): eZ\Publish\Core\Persistence\Cache\ContentHandler-&gt;load(126, 1, NULL)
      #8 /home/dp/dev/ezpublish5/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/Repository/ContentService.php(1494): eZ\Publish\Core\Repository\ContentService-&gt;internalLoadContent(126, NULL, 1)
      #9 /home/dp/dev/ezpublish5/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/SignalSlot/ContentService.php(416): eZ\Publish\Core\Repository\ContentService-&gt;publishVersion(Object(eZ\Publish\Core\Repository\Values\Content\VersionInfo))
      #10 /home/dp/dev/ezpublish5/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/REST/Server/Controller/Content.php(517): eZ\Publish\Core\SignalSlot\ContentService-&gt;publishVersion(Object(eZ\Publish\Core\Repository\Values\Content\VersionInfo))
      #11 [internal function]: eZ\Publish\Core\REST\Server\Controller\Content-&gt;publishVersion('126', '1')
      #12 /home/dp/dev/ezpublish5/ezpublish/bootstrap.php.cache(2774): call_user_func_array(Array, Array)
      #13 /home/dp/dev/ezpublish5/ezpublish/bootstrap.php.cache(2748): Symfony\Component\HttpKernel\HttpKernel-&gt;handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
      #14 /home/dp/dev/ezpublish5/ezpublish/bootstrap.php.cache(2878): Symfony\Component\HttpKernel\HttpKernel-&gt;handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
      #15 /home/dp/dev/ezpublish5/ezpublish/bootstrap.php.cache(2179): Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel-&gt;handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
      #16 /home/dp/dev/ezpublish5/vendor/ezsystems/ezpublish-kernel/eZ/Bundle/EzPublishCoreBundle/Kernel.php(62): Symfony\Component\HttpKernel\Kernel-&gt;handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
      #17 /home/dp/dev/ezpublish5/web/index.php(64): eZ\Bundle\EzPublishCoreBundle\Kernel-&gt;handle(Object(Symfony\Component\HttpFoundation\Request))
      #18 {main}</trace>
       <file>/home/dp/dev/ezpublish5/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/IO/Handler/Legacy.php</file>
       <line>536</line>
      </ErrorMessage
       
      
      

        Activity

        Hide
        Bertrand Dunogier added a comment -

        Successfully reproduced.

        Show
        Bertrand Dunogier added a comment - Successfully reproduced.
        Show
        Bertrand Dunogier added a comment - Pull request: https://github.com/ezsystems/ezpublish-kernel/pull/503 .
        Hide
        Bertrand Dunogier added a comment - - edited
        Show
        Bertrand Dunogier added a comment - - edited Merged to master: https://github.com/ezsystems/ezpublish-kernel/commit/ddd61a2 .
        Hide
        Joao Pingo (Inactive) added a comment - - edited

        Created tc-1817
        Test Passed ... QA Approved

        Show
        Joao Pingo (Inactive) added a comment - - edited Created tc-1817 Test Passed ... QA Approved

          People

          • Assignee:
            Unassigned
            Reporter:
            Damien Pobel
          • Votes:
            0 Vote for this issue
            Watchers:
            3 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 - 6 hours, 30 minutes
              6h 30m