dita-ot / dita-ot

DITA Open Toolkit — the open-source publishing engine for content authored in the Darwin Information Typing Architecture.
https://www.dita-ot.org
Apache License 2.0
386 stars 193 forks source link

DITA OT Project - percent encoded chars appear in PDF output file name #4412

Closed raducoravu closed 2 months ago

raducoravu commented 3 months ago

We received this initial report here: https://www.oxygenxml.com/forum/viewtopic.php?f=20&t=26580

I tested with DITA OT 4.2, for a DITA OT project file like this:

  <deliverable>
    <context name="Access Control">
      <input href="file:/D:/../samples/dita/flowers/flo%20w%20ers.ditamap"/>
    </context>
    <output href="./Standard%20dev/"/>
    <publication name="pdf" transtype="pdf2"/>
  </deliverable>
</project>

the output file name on disk will be "flo%20w%20ers.pdf" so containing the URI escaped chars in the local file name.

jelovirt commented 3 months ago

Can't reproduce this with 4.2 on macOS. @raducoravu are you able to verify whether this only occurs on Windows?

raducoravu commented 3 months ago

@jelovirt I can reproduce this problem with DITA OT 4.2 also on Mac OS, I run:

sh dita -p /Users/../samples/dita/flowers/prj.xml -v

I get in the console:

/var/folders/temp.../deliverable-1/topic.fo -> /Users/../dita-ot-4.2/bin/out/Standarddev/flo%20w%20ers.pdf

and the file on disk has actual percents in its name.

jelovirt commented 2 months ago

The root cause is https://github.com/dita-ot/dita-ot/blob/develop/src/main/plugins/org.dita.base/build_preprocess2_template.xml#L86 that doesn't support URIs. This needs to be replaced with custom task.

raducoravu commented 2 months ago

Maybe a quick fix would be at least a regexp replace of %20 with a single space but indeed a custom task would be necessary.

raducoravu commented 2 months ago

@jelovirt thanks for the fix, I tested it and I confirm it works on Windows.