Fix relative links to files in export all PDF [SCI-2804]

This commit is contained in:
Oleksii Kriuchykhin 2018-10-19 16:25:43 +02:00
parent 00139beb89
commit 83566cc9d5
2 changed files with 6 additions and 6 deletions

View file

@ -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

View file

@ -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)