changeset 1832:b9708d66277c beta

fixed problem with anchor links that contains non ascii chars - anchor links are now based on md5 of path and not path safe web representation
author Marcin Kuzminski <marcin@python-works.com>
date Thu, 05 Jan 2012 17:02:42 +0200
parents ca302053d9c2
children aa4423c82c23
files rhodecode/lib/helpers.py
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/lib/helpers.py	Thu Jan 05 16:47:48 2012 +0200
+++ b/rhodecode/lib/helpers.py	Thu Jan 05 17:02:42 2012 +0200
@@ -14,6 +14,7 @@
 from pygments import highlight as code_highlight
 from pylons import url, request, config
 from pylons.i18n.translation import _, ungettext
+from hashlib import md5
 
 from webhelpers.html import literal, HTML, escape
 from webhelpers.html.tools import *
@@ -56,12 +57,14 @@
 
 def FID(raw_id, path):
     """
-    Creates a uniqe ID for filenode based on it's path and revision
+    Creates a uniqe ID for filenode based on it's hash of path and revision
+    it's safe to use in urls
 
     :param raw_id:
     :param path:
     """
-    return 'C-%s-%s' % (short_id(raw_id), safeid(safe_unicode(path)))
+
+    return 'C-%s-%s' % (short_id(raw_id), md5(path).hexdigest()[:12])
 
 
 def get_token():