Permalink
Browse files

Make FileFile.get_file_name cope with sitiuations where self.file.nam…

…e is not set.

This is quite an often situation: an user uploads a file to filer it doesn't set the name explicitly, therefore the original_filename is used.
  • Loading branch information...
1 parent b4655f1 commit c37a63a4f6d60bbf352710c0afe05c33638fbad8 @kux committed Jan 14, 2013
Showing with 5 additions and 1 deletion.
  1. +5 −1 cmsplugin_filer_file/models.py
@@ -32,7 +32,11 @@ def file_exists(self):
return exists(self.file.path)
def get_file_name(self):
- return self.file.name
+ if self.file.name in ('', None):
+ name = u"%s" % (self.file.original_filename,)
+ else:
+ name = u"%s" % (self.file.name,)
+ return name
def get_ext(self):
return self.file.extension

0 comments on commit c37a63a

Please sign in to comment.