Browse Source

Closes #169: File upload with same filename except extension fails

Bastien Sevajol (Algoo) 8 years ago
parent
commit
39670bece8
1 changed files with 7 additions and 2 deletions
  1. 7 2
      tracim/tracim/controllers/content.py

+ 7 - 2
tracim/tracim/controllers/content.py View File

287
 
287
 
288
     @tg.require(current_user_is_contributor())
288
     @tg.require(current_user_is_contributor())
289
     @tg.expose()
289
     @tg.expose()
290
-    def put(self, item_id, file_data=None, comment=None, label=''):
290
+    def put(self, item_id, file_data=None, comment=None, label=None):
291
         # TODO - SECURE THIS
291
         # TODO - SECURE THIS
292
         workspace = tmpl_context.workspace
292
         workspace = tmpl_context.workspace
293
 
293
 
294
         try:
294
         try:
295
             api = ContentApi(tmpl_context.current_user)
295
             api = ContentApi(tmpl_context.current_user)
296
             item = api.get_one(int(item_id), self._item_type, workspace)
296
             item = api.get_one(int(item_id), self._item_type, workspace)
297
-            label_changed = label != item.label
297
+            label_changed = False
298
+            if label is not None and label != item.label:
299
+                label_changed = True
300
+
301
+            if label is None:
302
+                label = ''
298
 
303
 
299
             # TODO - D.A. - 2015-03-19
304
             # TODO - D.A. - 2015-03-19
300
             # refactor this method in order to make code easier to understand
305
             # refactor this method in order to make code easier to understand