Fail to update a document content and generating a new version through Rest API

cancel
Showing results for 
Search instead for 
Did you mean: 
mohvmedov
Member II

Fail to update a document content and generating a new version through Rest API

We are encountering a bug in the document content update service api generating a new version of the document.

The bug occurs when trying to update a document through curl or postman:

When trying to update the content of the document already present in a directory, through CURL or postman, using the Update Node Content webservice (localhost/api-explorer/?urls.primaryName=Core%20API#/ nodes/updateNodeContent), we encounter a bug for WORD, XLSX, PPT files.

We proceed to update using CURL :

curl -X PUT -u user : password "localhost/alfresco/api/-default-/public/alfresco/versions/1/nodes/e0e70652-bfe8-466b-89c7-edca40400639/content?majorVersion=false&comment=newVersion&name=yoda- 2.docx" -H "accept: application/json" -H "Content-Type: application/octet-stream" -F "filedata=@/C:/link/to/path/yoda.docx"

After launching the curl command, the content of the file is modified and the version is also incremented but the document is no longer readable and at the level of the share interface, when we try to view the document we see the error "unreadable pdf format" and when we download the original version of the file we see a popup saying that the file has been corrupted.

NB: the update of a PDF type document is done automatically without failure and a new version is generated successfully. And the bug is only encountered when updating by CURL or postman, but no error when going through the share interface directly.

Screen 1 : Opening in share an EXCEL file after update

 Screenshot 2023-05-11 151454.png


Screen 2 : Downloading and opening an EXCEL file after updating

 Screenshot 2023-05-11 151559.png

 

API : https://api-explorer.alfresco.com/api-explorer/#/nodes/updateNodeContent

Curl : curl -X PUT -u ged-site-test:ged-site-test "https://localhost/alfresco/api/-default-/public/alfresco/versions/1/nodes/e0e70652-bfe8-466b-89c7-ed..." -H  "accept: application/json" -H  "Content-Type: application/octet-stream" -F "filedata=@/C:/link/to/path/y

oda.docx"


Stacktrace:

user 'alfresco'.

2023-05-11 14:51:31,687 INFO  [org.alfresco.repo.admin] [http-nio-8080-exec-6] Connected to database PostgreSQL version 12.11

2023-05-11 14:51:31,687 INFO  [org.alfresco.rest.api.probes.ProbeEntityResource] [http-nio-8080-exec-6] readyProbe: Success - Tested

2023-05-11 14:51:51,719 INFO  [org.alfresco.repo.admin] [http-nio-8080-exec-17] Using database URL 'jdbcSmiley Tongueostgresql://alfresco-integration.sgbd.inrae.fr:54321/alfresco-integration' wit

h user 'alfresco'.

2023-05-11 14:51:51,720 INFO  [org.alfresco.repo.admin] [http-nio-8080-exec-17] Connected to database PostgreSQL version 12.11

2023-05-11 14:51:51,720 INFO  [org.alfresco.rest.api.probes.ProbeEntityResource] [http-nio-8080-exec-17] readyProbe: Success - Tested

2023-05-11 14:52:11,760 INFO  [org.alfresco.repo.admin] [http-nio-8080-exec-2] Using database URL 'jdbcSmiley Tongueostgresql://alfresco-integration.sgbd.inrae.fr:54321/alfresco-integration' with

 user 'alfresco'.

2023-05-11 14:52:11,761 INFO  [org.alfresco.repo.admin] [http-nio-8080-exec-2] Connected to database PostgreSQL version 12.11

2023-05-11 14:52:11,761 INFO  [org.alfresco.rest.api.probes.ProbeEntityResource] [http-nio-8080-exec-2] readyProbe: Success - Tested

2023-05-11 14:52:15,435 ERROR [org.alfresco.enterprise.repo.rendition2.TransformEventProcessor] [pool-9-thread-194] TransformService response for docx json -- metadataExtract -- failed

 with status code: 500 errorDetails: Max retries (3) exceeded: Failed at processing transformation - TransformException: Error creating OOXML extractor, cause TikaException: Error crea

ting OOXML extractor, cause NotOfficeXmlFileException: No valid entries or contents found, this is not a valid OOXML (Office Open XML) file, cause ZipException: Unexpected record signa

ture: 0X2D2D2D2D. Consuming failed rendition.

2023-05-11 14:52:31,798 INFO  [org.alfresco.repo.admin] [http-nio-8080-exec-5] Using database URL 'jdbcSmiley Tongueostgresql://alfresco-integration.sgbd.inrae.fr:54321/alfresco-integration' with

 user 'alfresco'.

2023-05-11 14:52:31,799 INFO  [org.alfresco.repo.admin] [http-nio-8080-exec-5] Connected to database PostgreSQL version 12.11

2023-05-11 14:52:31,799 INFO  [org.alfresco.rest.api.probes.ProbeEntityResource] [http-nio-8080-exec-5] readyProbe: Success - Tested

2023-05-11 14:52:51,834 INFO  [org.alfresco.repo.admin] [http-nio-8080-exec-2] Using database URL 'jdbcSmiley Tongueostgresql://alfresco-integration.sgbd.inrae.fr:54321/alfresco-integration' with

 user 'alfresco'.

2023-05-11 14:52:51,835 INFO  [org.alfresco.repo.admin] [http-nio-8080-exec-2] Connected to database PostgreSQL version 12.11

2023-05-11 14:52:51,835 INFO  [org.alfresco.rest.api.probes.ProbeEntityResource] [http-nio-8080-exec-2] readyProbe: Success - Tested

2023-05-11 14:53:00,843 ERROR [org.alfresco.repo.web.scripts.RepositoryContainer] [http-nio-8080-exec-15] Server error (04110876)

org.springframework.extensions.webscripts.WebScriptException: 04110560 Wrapped Exception (with status template): 04110875 Failed to execute script 'classpath*:alfresco/templates/webscr

ipts/org/alfresco/repository/thumbnail/thumbnail.get.js': 04110874 Content conversion failed:

   reader: ContentAccessor[ contentUrl=store://2023/5/11/14/51/a1d8dec2-3765-4c24-858d-5dfcaa662186.bin, mimetype=application/vnd.openxmlformats-officedocument.wordprocessingml.documen

t, size=12305, encoding=UTF-8, locale=fr_FR]

   writer: ContentAccessor[ contentUrl=store://2023/5/11/14/53/fa6a47cc-6b90-475a-ba30-9d06eadd3089.bin, mimetype=application/pdf, size=0, encoding=UTF-8, locale=fr_FR]

   options: {}

        at org.springframework.extensions.webscripts.AbstractWebScript.createStatusException(AbstractWebScript.java:1139)

        at org.alfresco.repo.web.scripts.content.StreamContent.execute(StreamContent.java:202)

        at org.alfresco.repo.web.scripts.RepositoryContainer.lambda$transactionedExecute$2(RepositoryContainer.java:553)

        at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:450)

        at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:544)

        at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:685)

        at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:721)

        at org.alfresco.repo.web.scripts.RepositoryContainer.executeScriptInternal(RepositoryContainer.java:413)

        at org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:309)

        at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:423)

        at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:210)

        at org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:131)

        at org.alfresco.repo.web.scripts.AlfrescoWebScriptServlet.service(AlfrescoWebScriptServlet.java:43)

        at javax.servlet.http.HttpServlet.service(HttpServlet.java:764)

Caused by: org.alfresco.scripts.ScriptException: 04110875 Failed to execute script 'classpath*:alfresco/templates/webscripts/org/alfresco/repository/thumbnail/thumbnail.get.js': 041108

74 Content conversion failed:

   reader: ContentAccessor[ contentUrl=store://2023/5/11/14/51/a1d8dec2-3765-4c24-858d-5dfcaa662186.bin, mimetype=application/vnd.openxmlformats-officedocument.wordprocessingml.documen

t, size=12305, encoding=UTF-8, locale=fr_FR]

   writer: ContentAccessor[ contentUrl=store://2023/5/11/14/53/fa6a47cc-6b90-475a-ba30-9d06eadd3089.bin, mimetype=application/pdf, size=0, encoding=UTF-8, locale=fr_FR]

   options: {}

        at org.alfresco.repo.jscript.RhinoScriptProcessor.execute(RhinoScriptProcessor.java:214)

        at org.alfresco.repo.processor.ScriptServiceImpl.execute(ScriptServiceImpl.java:219)

        at org.alfresco.repo.processor.ScriptServiceImpl.executeScript(ScriptServiceImpl.java:181)

        at org.alfresco.repo.web.scripts.RepositoryScriptProcessor.executeScript(RepositoryScriptProcessor.java:109)

        at org.springframework.extensions.webscripts.AbstractWebScript.executeScript(AbstractWebScript.java:1376)

        at org.alfresco.repo.web.scripts.content.StreamContent.execute(StreamContent.java:146)

        ... 50 more

Caused by: org.alfresco.service.cmr.repository.ContentIOException: 04110874 Content conversion failed:

   reader: ContentAccessor[ contentUrl=store://2023/5/11/14/51/a1d8dec2-3765-4c24-858d-5dfcaa662186.bin, mimetype=application/vnd.openxmlformats-officedocument.wordprocessingml.documen

t, size=12305, encoding=UTF-8, locale=fr_FR]

   writer: ContentAccessor[ contentUrl=store://2023/5/11/14/53/fa6a47cc-6b90-475a-ba30-9d06eadd3089.bin, mimetype=application/pdf, size=0, encoding=UTF-8, locale=fr_FR]

   options: {}

        at org.alfresco.repo.content.transform.AbstractLocalTransform.retryWithDifferentMimetype(AbstractLocalTransform.java:231)

        at org.alfresco.repo.content.transform.AbstractLocalTransform.transformWithDebug(AbstractLocalTransform.java:165)

        at org.alfresco.repo.content.transform.AbstractLocalTransform.transform(AbstractLocalTransform.java:121)

        at org.alfresco.repo.rendition2.LocalSynchronousTransformClient.transform(LocalSynchronousTransformClient.java:148)

        at org.alfresco.repo.rendition.executer.AbstractTransformationRenderingEngine$TransformationCallable$1.doWork(AbstractTransformationRenderingEngine.java:456)

1 Reply
signshah
Customer

Re: Fail to update a document content and generating a new version through Rest API

Hello,

Did you get any solution of this? I am having the similar issue. After uploading a new doc version on pdf, the preview is not working. 

 

Thanks