From 83566cc9d54488417a8db799cb26735e7fdd7e3b Mon Sep 17 00:00:00 2001 From: Oleksii Kriuchykhin Date: Fri, 19 Oct 2018 16:25:43 +0200 Subject: [PATCH] Fix relative links to files in export all PDF [SCI-2804] --- app/models/project.rb | 9 +++------ app/models/team_zip_export.rb | 3 +++ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/models/project.rb b/app/models/project.rb index da266594d..16952fb2a 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -274,7 +274,7 @@ class Project < ApplicationRecord end end - parsed_pdf = ApplicationController.render( + ApplicationController.render( pdf: pdf_name, header: { right: '[page] of [topage]' }, locals: { content: parsed_pdf_html.to_s }, @@ -282,11 +282,8 @@ class Project < ApplicationRecord disable_javascript: true, disable_internal_links: false, current_user: user, - current_team: team + current_team: team, + extra: '--keep-relative-links' ) - # Dirty workaround to convert absolute links back to relative ones, since - # WickedPdf does the opposite, based on the path where the file parsing is - # done - parsed_pdf.gsub('/URI (file:////tmp/', '/URI (') end end diff --git a/app/models/team_zip_export.rb b/app/models/team_zip_export.rb index e159deea0..15c78511d 100644 --- a/app/models/team_zip_export.rb +++ b/app/models/team_zip_export.rb @@ -63,6 +63,9 @@ class TeamZipExport < ZipExport root += "/#{project_name}" FileUtils.mkdir_p(root) + Dir.chdir(root) + root = '.' + inventories = "#{root}/Inventories" FileUtils.mkdir_p(inventories)