Fix encoding

pull/6607/head
Oliver Günther 6 years ago
parent af6a70a0f1
commit e8efb4cc9f
No known key found for this signature in database
GPG Key ID: A3A8BDAD7C0C552C
  1. 5
      lib/open_project/text_formatting/formats/markdown/pandoc_wrapper.rb
  2. 1
      lib/open_project/text_formatting/formats/markdown/textile_converter.rb

@ -46,6 +46,7 @@ module OpenProject::TextFormatting::Formats
end
def check_arguments!
PandocDownloader.check_or_download!
wrap_mode
read_output_formats
end
@ -114,7 +115,9 @@ module OpenProject::TextFormatting::Formats
child = POSIX::Spawn::Child.new(PandocDownloader.pandoc_path, *command, input: stdin_data, timeout: timeout)
raise child.err unless child.status.success?
child.out
# posix-spawn forces binary output, however pandoc
# only works with UTF-8
child.out.force_encoding('UTF-8')
rescue POSIX::Spawn::TimeoutExceeded => e
raise Timeout::Error, "Timeout occurred while running pandoc: #{e.message}"
end

@ -168,7 +168,6 @@ module OpenProject::TextFormatting::Formats
if markdowns_in_groups.length != orig_values.length
# Error handling: Some textile seems to be misformed e.g. <pre>something</pre (without closing >).
# In such cases, handle texts individually to avoid the error affecting other texts
logger.warn "Mismatch detected in conversion result. Retrying all items individually one time."
progress = ProgressBar.create(title: "Converting items individually due to pandoc mismatch", total: orig_values.length)
markdowns = old_values.map do |old_value|
res = convert_textile_to_markdown(old_value, raise_on_timeout: false)

Loading…
Cancel
Save