roadmap icon indicating copy to clipboard operation
roadmap copied to clipboard

Error downloading docx version of a plan

Open gjacob24 opened this issue 2 years ago • 4 comments

Please complete the following fields as applicable:

What version of the DMPRoadmap code are you running? (e.g. v2.2.0) v3.1.1 Expected behaviour: to open a downloaded copy docx version of a plan Actual behaviour: downloads the plan but throws an error when you try to open it in MS Word Screenshot 2022-08-10 at 15 25 25

Cause for error: The content of the plan contains Windows file path with slashes and digits which is being confused as code.

gjacob24 avatar Aug 10 '22 14:08 gjacob24

LibreOffice was helpful in showing error line in docx file with .zip and extracting word\document.xml

LibreOffice_error

The error was on the following line in document.xml created by malformed xml Selection_003

gjacob24 avatar Aug 10 '22 14:08 gjacob24

@johnpinto1 found the error and suggested a temporary solution:

use \\ for \ in Windows paths.

gjacob24 avatar Aug 10 '22 14:08 gjacob24

good catch @gjacob24!

Have a look at the config options for the wicked_pdf gem. There might be something in there to help properly escape these. If anything, the show_as_html: true option might make it easier to debug or verify that your changes are working as expected. If not you may just need to address it in the view.

briri avatar Aug 10 '22 15:08 briri

@briri @gjacob24 It looks like issue affects only docx downloads too. But does not break the rendering:

Text should have this file path

G:\Hematologie\Onderzoek\Studie Team Hematologie\Studies op alfabet\Aankomende studies\RODEO\00. DIGITAAL ISF\13. Case report Form (CRF)

Rendered correctly as:

HTML: Selection_008 TEXT Selection_007 PDF Selection_006

As htmtoWord gem uses the HTML to create the DOCX file. Need to escape characters at that stage I think.

johnpinto1 avatar Aug 11 '22 10:08 johnpinto1