samvera / hydra-derivatives

Derivative generation for Samvera repositories
Other
17 stars 25 forks source link

`soffice` command results in an error if the filename contains special characters. #163

Closed jonathandixon closed 7 years ago

jonathandixon commented 7 years ago

When running Hydra::Derivatives::DocumentDerivatives with a file name that includes parenthesis soffice exits with an error.

Unable to execute command "soffice --invisible --headless --convert-to pdf --outdir /tmp /tmp/file(1).pptx".
Exit code: pid 18230 exit 2 Error message: sh: 1: Syntax error: "(" unexpected
jonathandixon commented 7 years ago

I wonder if this is as simple as quoting #{path} on this line

execute "#{Hydra::Derivatives.libreoffice_path} --invisible --headless --convert-to #{format} --outdir #{outdir} \"#{path}\""

I'm not sure it this will have unwanted consequences. Should there also be a check to determine if the path is already quoted?

mjgiarlo commented 7 years ago

@jonathandixon I wonder if we should run the path through a method like https://ruby-doc.org/stdlib-2.3.0/libdoc/shellwords/rdoc/Shellwords.html#method-c-shellescape

cjcolvar commented 7 years ago

Fixed by #164.