[filefield] normalized file names to deal with windows files stable
authorStephanie Marcu <stephanie.marcu@logilab.fr>
Wed, 16 Jun 2010 09:33:04 +0200
branchstable
changeset 5756 ab03e4adb4f1
parent 5755 ca9e1c9123d7
child 5757 e501806ab489
[filefield] normalized file names to deal with windows files
web/formfields.py
--- a/web/formfields.py	Wed Jun 16 09:30:30 2010 +0200
+++ b/web/formfields.py	Wed Jun 16 09:33:04 2010 +0200
@@ -82,6 +82,8 @@
     it
     """
 
+def normalize_filename(filename):
+    return filename.split('\\')[-1]
 
 def vocab_sort(vocab):
     """sort vocabulary, considering option groups"""
@@ -736,7 +738,7 @@
             value = None
         else:
             # set filename on the Binary instance, may be used later in hooks
-            value.filename = filename
+            value.filename = normalize_filename(filename)
         return value