mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-09-21 07:26:15 +08:00
Fix relative links to files in export all PDF [SCI-2804]
This commit is contained in:
parent
00139beb89
commit
83566cc9d5
|
@ -274,7 +274,7 @@ class Project < ApplicationRecord
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
parsed_pdf = ApplicationController.render(
|
ApplicationController.render(
|
||||||
pdf: pdf_name,
|
pdf: pdf_name,
|
||||||
header: { right: '[page] of [topage]' },
|
header: { right: '[page] of [topage]' },
|
||||||
locals: { content: parsed_pdf_html.to_s },
|
locals: { content: parsed_pdf_html.to_s },
|
||||||
|
@ -282,11 +282,8 @@ class Project < ApplicationRecord
|
||||||
disable_javascript: true,
|
disable_javascript: true,
|
||||||
disable_internal_links: false,
|
disable_internal_links: false,
|
||||||
current_user: user,
|
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
|
||||||
end
|
end
|
||||||
|
|
|
@ -63,6 +63,9 @@ class TeamZipExport < ZipExport
|
||||||
root += "/#{project_name}"
|
root += "/#{project_name}"
|
||||||
FileUtils.mkdir_p(root)
|
FileUtils.mkdir_p(root)
|
||||||
|
|
||||||
|
Dir.chdir(root)
|
||||||
|
root = '.'
|
||||||
|
|
||||||
inventories = "#{root}/Inventories"
|
inventories = "#{root}/Inventories"
|
||||||
FileUtils.mkdir_p(inventories)
|
FileUtils.mkdir_p(inventories)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue