aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2015-05-11 16:07:17 +0100
committerLouise Crow <louise.crow@gmail.com>2015-05-15 15:49:35 +0100
commit74b6a28dac91232d8c6b66903f7d15dd39ac8857 (patch)
tree949dc99720dd0ab35258000726c2c5a2cba55fad
parent824771a4fb7846bec13e395e44f14718ff30d17d (diff)
Use a relative path in call to pdftohtml.
pdftohtml will use the file path as the basis for generating the image links in the generated HTML, so we want them to be relative, not absolute. Ruby 1.9 tempfile.path will generate an absolute path when given the current directory as the tmpdir, whilst 2.0 and 1.8 will use a relative one.
-rw-r--r--lib/attachment_to_html/adapters/pdf.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/attachment_to_html/adapters/pdf.rb b/lib/attachment_to_html/adapters/pdf.rb
index 3183d1fd0..4543b2d79 100644
--- a/lib/attachment_to_html/adapters/pdf.rb
+++ b/lib/attachment_to_html/adapters/pdf.rb
@@ -70,10 +70,10 @@ module AttachmentToHTML
@converted ||= Dir.chdir(tmpdir) do
tempfile = create_tempfile(text)
-
html = AlaveteliExternalCommand.run("pdftohtml",
"-nodrm", "-zoom", "1.0", "-stdout", "-enc", "UTF-8",
- "-noframes", tempfile.path, :timeout => 30, :binary_output => false
+ "-noframes", "./#{File.basename(tempfile.path)}",
+ :timeout => 30, :binary_output => false
)
cleanup_tempfile(tempfile)