diff --git a/lib/redmine/scm/adapters/mercurial/hg-template-0.9.5.tmpl b/lib/redmine/scm/adapters/mercurial/hg-template-0.9.5.tmpl
index b3029e6f..3cf584ae 100644
--- a/lib/redmine/scm/adapters/mercurial/hg-template-0.9.5.tmpl
+++ b/lib/redmine/scm/adapters/mercurial/hg-template-0.9.5.tmpl
@@ -3,10 +3,10 @@ changeset_quiet = 'This template must be used with --debug option\n'
changeset_verbose = 'This template must be used with --debug option\n'
changeset_debug = '\n{author|escape}\n{date|isodate}\n\n{files}{file_adds}{file_dels}{file_copies}\n{desc|escape}\n{tags}\n\n'
-file = '{file|escape}\n'
-file_add = '{file_add|escape}\n'
-file_del = '{file_del|escape}\n'
-file_copy = '{name|urlescape}\n'
+file = '{file|urlescape}\n'
+file_add = '{file_add|urlescape}\n'
+file_del = '{file_del|urlescape}\n'
+file_copy = '{name|urlescape}\n'
tag = '{tag|escape}\n'
header='\n\n\n'
# footer=""
\ No newline at end of file
diff --git a/lib/redmine/scm/adapters/mercurial/hg-template-1.0.tmpl b/lib/redmine/scm/adapters/mercurial/hg-template-1.0.tmpl
index b6cc7a78..def80c26 100644
--- a/lib/redmine/scm/adapters/mercurial/hg-template-1.0.tmpl
+++ b/lib/redmine/scm/adapters/mercurial/hg-template-1.0.tmpl
@@ -3,10 +3,10 @@ changeset_quiet = 'This template must be used with --debug option\n'
changeset_verbose = 'This template must be used with --debug option\n'
changeset_debug = '\n{author|escape}\n{date|isodatesec}\n\n{file_mods}{file_adds}{file_dels}{file_copies}\n{desc|escape}\n{tags}\n\n'
-file_mod = '{file_mod|escape}\n'
-file_add = '{file_add|escape}\n'
-file_del = '{file_del|escape}\n'
-file_copy = '{name|urlescape}\n'
+file_mod = '{file_mod|urlescape}\n'
+file_add = '{file_add|urlescape}\n'
+file_del = '{file_del|urlescape}\n'
+file_copy = '{name|urlescape}\n'
tag = '{tag|escape}\n'
header='\n\n\n'
# footer=""
diff --git a/lib/redmine/scm/adapters/mercurial_adapter.rb b/lib/redmine/scm/adapters/mercurial_adapter.rb
index 72dc5dd2..be755419 100644
--- a/lib/redmine/scm/adapters/mercurial_adapter.rb
+++ b/lib/redmine/scm/adapters/mercurial_adapter.rb
@@ -16,6 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
require 'redmine/scm/adapters/abstract_adapter'
+require 'cgi'
module Redmine
module Scm
@@ -127,8 +128,8 @@ module Redmine
from_rev = logentry.attributes['revision']
end
paths << {:action => path.attributes['action'],
- :path => "/#{path.text}",
- :from_path => from_path ? "/#{from_path}" : nil,
+ :path => "/#{CGI.unescape(path.text)}",
+ :from_path => from_path ? "/#{CGI.unescape(from_path)}" : nil,
:from_revision => from_rev ? from_rev : nil
}
end