Uploaded image for project: 'CMS'
  1. CMS
  2. CMS-9605

Unable to save content after moving a repeater entry which contains an image

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • 4.3.11, 4.4.0
    • None
    • None
    • None

      How to reproduce

      • Edit a content with repeater entries with rich text (FAQ content for example)
      • Add 2 entries of repeater
      • Insert an image in a rich text of a repeater entry
      • Save
      • Redit the content
      • Move the entry which contains the image

      I cannot save the content with the following error

      Impossible d'enregistrer le contenu car un champ contient des erreurs.
      questions.1.answer
      Impossible de transformer le texte riche : Exception during processing of cocoon://_plugins/cms/convert/html2docbook.

      In logs

      Caused by: org.ametys.plugins.repository.metadata.UnknownMetadataException: javax.jcr.PathNotFoundException: smiley_content.jpg
      	at org.ametys.plugins.repository.metadata.jcr.JCRFolder.getFile(JCRFolder.java:184)
      	at org.ametys.plugins.repository.metadata.jcr.JCRFolder.getFile(JCRFolder.java:1)
      	at org.ametys.cms.transformation.htmledition.UploadedDataHTMLEditionHandler._processLocal(UploadedDataHTMLEditionHandler.java:469)
      	at org.ametys.cms.transformation.htmledition.UploadedDataHTMLEditionHandler.startElement(UploadedDataHTMLEditionHandler.java:135)
      	at org.ametys.cms.transformation.htmledition.AbstractHTMLEditionHandler.startElement(AbstractHTMLEditionHandler.java:93)
      	at org.ametys.web.editor.WebHTMLEditionHandler.startElement(WebHTMLEditionHandler.java:113)
      	at org.ametys.cms.transformation.htmledition.HTMLEditorHandlers2DocbookTransformer.startElement(HTMLEditorHandlers2DocbookTransformer.java:106)
      	at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
      	at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source)
      	at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
      	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
      	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
      	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
      	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
      	at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
      	at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
      	at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
      	at org.apache.excalibur.xml.impl.JaxpParser.parse(JaxpParser.java:315)
      	at org.apache.excalibur.xml.impl.JaxpParser.parse(JaxpParser.java:334)
      	at org.ametys.cms.transformation.XhtmlGenerator.generate(XhtmlGenerator.java:60)
      	at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.processXMLPipeline(AbstractProcessingPipeline.java:581)
      	... 130 more
      Caused by: javax.jcr.PathNotFoundException: smiley_content.jpg
      	at org.apache.jackrabbit.core.NodeImpl$8.perform(NodeImpl.java:2167)
      	at org.apache.jackrabbit.core.NodeImpl$8.perform(NodeImpl.java:2161)
      	at org.apache.jackrabbit.core.session.SessionState.perform(SessionState.java:216)
      	at org.apache.jackrabbit.core.ItemImpl.perform(ItemImpl.java:91)
      	at org.apache.jackrabbit.core.NodeImpl.getNode(NodeImpl.java:2161)
      	at org.ametys.plugins.repository.metadata.jcr.JCRFolder.getFile(JCRFolder.java:179)
      	... 150 more
      

          [CMS-9605] Unable to save content after moving a repeater entry which contains an image

          Laurence Aumeunier added a comment - - edited

          UploadedDataHTMLEditionHandler is called after EditContentFunction was moving the entries. So the path of image is not correct anymore.

          The path of image should be updated before moving entries or before calling UploadedDataHTMLEditionHandler .

          This could be done in JS as soon as the entry is moved (update data-ametys-src) ?
          Or by the EditContentFunction ?

          Not easy because repeater entries should be inspect to infinity. Indeed if the repeater entry contains sub-repeaters, the path of images in the sub repeater entries should be updated too...

          Laurence Aumeunier added a comment - - edited UploadedDataHTMLEditionHandler is called after EditContentFunction was moving the entries. So the path of image is not correct anymore. The path of image should be updated before moving entries or before calling UploadedDataHTMLEditionHandler . This could be done in JS as soon as the entry is moved (update data-ametys-src) ? Or by the EditContentFunction ? Not easy because repeater entries should be inspect to infinity. Indeed if the repeater entry contains sub-repeaters, the path of images in the sub repeater entries should be updated too...

            Unassigned Unassigned
            laurence Laurence Aumeunier
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: