diff --git a/app/models/web.rb b/app/models/web.rb
index ad87f373..efb218b8 100644
--- a/app/models/web.rb
+++ b/app/models/web.rb
@@ -56,8 +56,7 @@ class Web
wiki.file_yard(self).has_file?(name)
end
- def make_file_link(mode, name, text, base_url)
- link = CGI.escape(name)
+ def make_file_link(mode, link, text, base_url)
case mode
when :export
if has_file?(name) then "#{text}"
@@ -81,23 +80,23 @@ class Web
# It should not be used in menus, templates and such - instead, use link_to_page helper
def make_link(name, text = nil, options = {})
text = CGI.escapeHTML(text || WikiWords.separate(name))
+ link = CGI.escape(name)
mode = options[:mode] || :show
base_url = options[:base_url] || '..'
link_type = options[:link_type] || :show
case link_type.to_sym
when :show
- make_page_link(mode, name, text, base_url)
+ make_page_link(mode, link, text, base_url)
when :file
- make_file_link(mode, name, text, base_url)
+ make_file_link(mode, link, text, base_url)
when :pic
- make_pic_link(mode, name, text, base_url)
+ make_pic_link(mode, link, text, base_url)
else
raise "Unknown link type: #{link_type}"
end
end
- def make_page_link(mode, name, text, base_url)
- link = CGI.escape(name)
+ def make_page_link(mode, link, text, base_url)
case mode.to_sym
when :export
if has_page?(name) then %{#{text}}
@@ -114,8 +113,7 @@ class Web
end
end
- def make_pic_link(mode, name, text, base_url)
- link = CGI.escape(name)
+ def make_pic_link(mode, link, text, base_url)
case mode.to_sym
when :export
if has_file?(name) then %{}