lib/isodoc/function/utils.rb in isodoc-2.6.1 vs lib/isodoc/function/utils.rb in isodoc-2.6.2
- old
+ new
@@ -175,19 +175,21 @@
%r{^data:(?<imgclass>image|application)/(?<imgtype>[^;]+);(?:charset=[^;]+;)?base64,(?<imgdata>.+)$} =~ uri
imgtype = "emf" if emf?("#{imgclass}/#{imgtype}")
imgtype = imgtype.sub(/\+[a-z0-9]+$/, "") # svg+xml
imgtype = "png" unless /^[a-z0-9]+$/.match? imgtype
imgtype == "postscript" and imgtype = "eps"
- Tempfile.open(["image", ".#{imgtype}"]) do |f|
+ Tempfile.open(["image", ".#{imgtype}"],
+ mode: File::BINARY | File::SHARE_DELETE) do |f|
f.binmode
f.write(Base64.strict_decode64(imgdata))
@tempfile_cache << f # persist to the end
f.path
end
end
def save_svg(img)
- Tempfile.open(["image", ".svg"]) do |f|
+ Tempfile.open(["image", ".svg"],
+ mode: File::BINARY | File::SHARE_DELETE) do |f|
f.write(img.to_xml)
@tempfile_cache << f # persist to the end
f.path
end
end