lib/pdfkit/middleware.rb in pdfkit-0.4.4 vs lib/pdfkit/middleware.rb in pdfkit-0.4.5
- old
+ new
@@ -40,10 +40,10 @@
# Change relative paths to absolute
def translate_paths(body, env)
# Host with protocol
root = env['rack.url_scheme'] + "://" + env['HTTP_HOST'] + "/"
- body.gsub!(/(href|src)=['"]\/([^\"']*|[^"']*)['"]/,'\1="'+root+'\2"')
+ body.gsub!(/(href|src)=(['"])\/([^\"']*|[^"']*)['"]/,'\1=\2'+root+'\3\2')
return body
end
def set_request_to_render_as_pdf(env)