EPFWIKI_BASE_URL should be without trailing slash
Run in a folder.
EPF-31
diff --git a/source/app/models/version.rb b/source/app/models/version.rb
index 806db21..4623f16 100644
--- a/source/app/models/version.rb
+++ b/source/app/models/version.rb
@@ -136,12 +136,16 @@
# Absolute path to the diff file and paths to the intermediate (tidied, cleaned) HTML files
def path_to_diff(from_version)
- return "#{ENV['EPFWIKI_ROOT_DIR']}#{ENV['EPFWIKI_PUBLIC_FOLDER']}/#{relpath_to_diff(from_version)}"
+ "#{ENV['EPFWIKI_ROOT_DIR']}#{ENV['EPFWIKI_PUBLIC_FOLDER']}/#{relpath_to_diff(from_version)}"
end
# Relative path to the diff file
def relpath_to_diff(from_version)
- return ENV['EPFWIKI_BASE_URL'] + self.wiki.rel_path + '/' + self.page.rel_path + "_EPFWIKI_DIFF_V#{from_version.version}_V#{self.version}.html"
+ '/' + self.wiki.rel_path + '/' + self.page.rel_path + "_EPFWIKI_DIFF_V#{from_version.version}_V#{self.version}.html"
+ end
+
+ def url_to_diff(from_version)
+ ENV['EPFWIKI_BASE_URL'] + self.relpath_to_diff(from_version)
end
# Path intermediate (tidied, cleaned) HTML files, prepared for XHTMLDiff
diff --git a/source/app/views/versions/diff.html.erb b/source/app/views/versions/diff.html.erb
index 98f9d4f..e7fd69e 100644
--- a/source/app/views/versions/diff.html.erb
+++ b/source/app/views/versions/diff.html.erb
@@ -33,10 +33,10 @@
Differences
</th>
<td class="sectionTableCell">
- <p><a href="<%= @version.relpath_to_diff(@version.source_version) %>" target="_blank">Open in a new window</a></p>
+ <p><a href="<%= @version.url_to_diff(@version.source_version) %>" target="_blank">Open in a new window</a></p>
<iframe
height = "600"
- src ="<%= @version.relpath_to_diff(@version.source_version) %>"
+ src ="<%= @version.url_to_diff(@version.source_version) %>"
width="100%">
</iframe>
</td>
diff --git a/source/config/environments/production.rb.example b/source/config/environments/production.rb.example
index e46ff14..0607796 100644
--- a/source/config/environments/production.rb.example
+++ b/source/config/environments/production.rb.example
@@ -3,7 +3,7 @@
ENV['EPFWIKI_APP_NAME'] = 'EPF Wiki'
ENV['EPFWIKI_REPLY_ADDRESS'] = "no-reply@epf.eclipse.org"
- ENV['EPFWIKI_BASE_URL'] = "http://localhost" # used for creating absolute links in emails, including slash
+ ENV['EPFWIKI_BASE_URL'] = "http://localhost" # used for creating absolute links in emails, without trailing slash
ENV['EPFWIKI_WINDOWS'] = 'N' # Y/N
ENV['EPFWIKI_PUBLIC_FOLDER'] = 'public'
ENV['EPFWIKI_ROOT_DIR'] = File.expand_path(Rails.root) + '/'