metanorma / html2doc

Ruby gem that converts an HTML page/document into a Microsoft Word `.doc` file
Other
30 stars 2 forks source link

Skip cleanup if 'src' missing #72

Closed CAMOBAP closed 2 years ago

CAMOBAP commented 2 years ago

Intro

The issue was discovered on docker (where inkscape missing) and this lead for such issue

stacktrace ``` Is a directory - read /usr/local/lib/ruby/2.7.0/fileutils.rb:1416:in `copy_stream' /usr/local/lib/ruby/2.7.0/fileutils.rb:1416:in `block (2 levels) in copy_file' /usr/local/lib/ruby/2.7.0/fileutils.rb:1415:in `open' /usr/local/lib/ruby/2.7.0/fileutils.rb:1415:in `block in copy_file' /usr/local/lib/ruby/2.7.0/fileutils.rb:1414:in `open' /usr/local/lib/ruby/2.7.0/fileutils.rb:1414:in `copy_file' /usr/local/lib/ruby/2.7.0/fileutils.rb:511:in `copy_file' /usr/local/lib/ruby/2.7.0/fileutils.rb:430:in `block in cp' /usr/local/lib/ruby/2.7.0/fileutils.rb:1589:in `block in fu_each_src_dest' /usr/local/lib/ruby/2.7.0/fileutils.rb:1605:in `fu_each_src_dest0' /usr/local/lib/ruby/2.7.0/fileutils.rb:1587:in `fu_each_src_dest' /usr/local/lib/ruby/2.7.0/fileutils.rb:429:in `cp' /usr/local/bundle/gems/html2doc-1.3.0.1/lib/html2doc/mime.rb:116:in `block in image_cleanup' /usr/local/bundle/gems/nokogiri-1.12.5-x86_64-linux/lib/nokogiri/xml/node.rb:979:in `traverse' /usr/local/bundle/gems/nokogiri-1.12.5-x86_64-linux/lib/nokogiri/xml/node.rb:978:in `block in traverse' /usr/local/bundle/gems/nokogiri-1.12.5-x86_64-linux/lib/nokogiri/xml/node_set.rb:239:in `block in each' /usr/local/bundle/gems/nokogiri-1.12.5-x86_64-linux/lib/nokogiri/xml/node_set.rb:238:in `upto' /usr/local/bundle/gems/nokogiri-1.12.5-x86_64-linux/lib/nokogiri/xml/node_set.rb:238:in `each' /usr/local/bundle/gems/nokogiri-1.12.5-x86_64-linux/lib/nokogiri/xml/node.rb:978:in `traverse' /usr/local/bundle/gems/nokogiri-1.12.5-x86_64-linux/lib/nokogiri/xml/node.rb:978:in `block in traverse' /usr/local/bundle/gems/nokogiri-1.12.5-x86_64-linux/lib/nokogiri/xml/node_set.rb:239:in `block in each' /usr/local/bundle/gems/nokogiri-1.12.5-x86_64-linux/lib/nokogiri/xml/node_set.rb:238:in `upto' /usr/local/bundle/gems/nokogiri-1.12.5-x86_64-linux/lib/nokogiri/xml/node_set.rb:238:in `each' /usr/local/bundle/gems/nokogiri-1.12.5-x86_64-linux/lib/nokogiri/xml/node.rb:978:in `traverse' /usr/local/bundle/gems/nokogiri-1.12.5-x86_64-linux/lib/nokogiri/xml/node.rb:978:in `block in traverse' /usr/local/bundle/gems/nokogiri-1.12.5-x86_64-linux/lib/nokogiri/xml/node_set.rb:239:in `block in each' /usr/local/bundle/gems/nokogiri-1.12.5-x86_64-linux/lib/nokogiri/xml/node_set.rb:238:in `upto' /usr/local/bundle/gems/nokogiri-1.12.5-x86_64-linux/lib/nokogiri/xml/node_set.rb:238:in `each' /usr/local/bundle/gems/nokogiri-1.12.5-x86_64-linux/lib/nokogiri/xml/node.rb:978:in `traverse' /usr/local/bundle/gems/nokogiri-1.12.5-x86_64-linux/lib/nokogiri/xml/node.rb:978:in `block in traverse' /usr/local/bundle/gems/nokogiri-1.12.5-x86_64-linux/lib/nokogiri/xml/node_set.rb:239:in `block in each' /usr/local/bundle/gems/nokogiri-1.12.5-x86_64-linux/lib/nokogiri/xml/node_set.rb:238:in `upto' /usr/local/bundle/gems/nokogiri-1.12.5-x86_64-linux/lib/nokogiri/xml/node_set.rb:238:in `each' /usr/local/bundle/gems/nokogiri-1.12.5-x86_64-linux/lib/nokogiri/xml/node.rb:978:in `traverse' /usr/local/bundle/gems/nokogiri-1.12.5-x86_64-linux/lib/nokogiri/xml/node.rb:978:in `block in traverse' /usr/local/bundle/gems/nokogiri-1.12.5-x86_64-linux/lib/nokogiri/xml/node_set.rb:239:in `block in each' /usr/local/bundle/gems/nokogiri-1.12.5-x86_64-linux/lib/nokogiri/xml/node_set.rb:238:in `upto' /usr/local/bundle/gems/nokogiri-1.12.5-x86_64-linux/lib/nokogiri/xml/node_set.rb:238:in `each' /usr/local/bundle/gems/nokogiri-1.12.5-x86_64-linux/lib/nokogiri/xml/node.rb:978:in `traverse' /usr/local/bundle/gems/nokogiri-1.12.5-x86_64-linux/lib/nokogiri/xml/node.rb:978:in `block in traverse' /usr/local/bundle/gems/nokogiri-1.12.5-x86_64-linux/lib/nokogiri/xml/node_set.rb:239:in `block in each' /usr/local/bundle/gems/nokogiri-1.12.5-x86_64-linux/lib/nokogiri/xml/node_set.rb:238:in `upto' /usr/local/bundle/gems/nokogiri-1.12.5-x86_64-linux/lib/nokogiri/xml/node_set.rb:238:in `each' /usr/local/bundle/gems/nokogiri-1.12.5-x86_64-linux/lib/nokogiri/xml/node.rb:978:in `traverse' /usr/local/bundle/gems/nokogiri-1.12.5-x86_64-linux/lib/nokogiri/xml/node.rb:978:in `block in traverse' /usr/local/bundle/gems/nokogiri-1.12.5-x86_64-linux/lib/nokogiri/xml/node_set.rb:239:in `block in each' /usr/local/bundle/gems/nokogiri-1.12.5-x86_64-linux/lib/nokogiri/xml/node_set.rb:238:in `upto' /usr/local/bundle/gems/nokogiri-1.12.5-x86_64-linux/lib/nokogiri/xml/node_set.rb:238:in `each' /usr/local/bundle/gems/nokogiri-1.12.5-x86_64-linux/lib/nokogiri/xml/node.rb:978:in `traverse' /usr/local/bundle/gems/nokogiri-1.12.5-x86_64-linux/lib/nokogiri/xml/node.rb:978:in `block in traverse' /usr/local/bundle/gems/nokogiri-1.12.5-x86_64-linux/lib/nokogiri/xml/node_set.rb:239:in `block in each' /usr/local/bundle/gems/nokogiri-1.12.5-x86_64-linux/lib/nokogiri/xml/node_set.rb:238:in `upto' /usr/local/bundle/gems/nokogiri-1.12.5-x86_64-linux/lib/nokogiri/xml/node_set.rb:238:in `each' /usr/local/bundle/gems/nokogiri-1.12.5-x86_64-linux/lib/nokogiri/xml/node.rb:978:in `traverse' /usr/local/bundle/gems/html2doc-1.3.0.1/lib/html2doc/mime.rb:109:in `image_cleanup' /usr/local/bundle/gems/html2doc-1.3.0.1/lib/html2doc/base.rb:56:in `cleanup' /usr/local/bundle/gems/html2doc-1.3.0.1/lib/html2doc/base.rb:44:in `process_html' /usr/local/bundle/gems/html2doc-1.3.0.1/lib/html2doc/base.rb:10:in `process' /usr/local/bundle/gems/metanorma-ogc-2.0.2/lib/isodoc/ogc/word_convert.rb:237:in `toWord' /usr/local/bundle/gems/isodoc-2.0.2/lib/isodoc/word_function/postprocess.rb:36:in `postprocess' /usr/local/bundle/gems/isodoc-2.0.2/lib/isodoc/convert.rb:186:in `convert' /usr/local/bundle/gems/isodoc-2.0.2/lib/isodoc/word_convert.rb:20:in `convert' /usr/local/bundle/gems/metanorma-ogc-2.0.2/lib/metanorma/ogc/processor.rb:47:in `output' /usr/local/bundle/gems/metanorma-1.4.4/lib/metanorma/compile.rb:199:in `process_output_threaded' /usr/local/bundle/gems/metanorma-1.4.4/lib/metanorma/compile.rb:191:in `block in process_exts1' /usr/local/bundle/gems/metanorma-1.4.4/lib/metanorma/worker_pool.rb:11:in `block (4 levels) in initialize' /usr/local/bundle/gems/metanorma-1.4.4/lib/metanorma/worker_pool.rb:9:in `loop' /usr/local/bundle/gems/metanorma-1.4.4/lib/metanorma/worker_pool.rb:9:in `block (3 levels) in initialize' /usr/local/bundle/gems/metanorma-1.4.4/lib/metanorma/worker_pool.rb:8:in `catch' /usr/local/bundle/gems/metanorma-1.4.4/lib/metanorma/worker_pool.rb:8:in `block (2 levels) in initialize' ```

Proposed fix

Skip cleanup if src attribute is missing

ronaldtse commented 2 years ago

@opoudjis can you have a look?