summaryrefslogtreecommitdiff
path: root/addons/website_slides/controllers/main.py
diff options
context:
space:
mode:
Diffstat (limited to 'addons/website_slides/controllers/main.py')
-rw-r--r--addons/website_slides/controllers/main.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/addons/website_slides/controllers/main.py b/addons/website_slides/controllers/main.py
index 4226f54dc34..7b67bfcbb40 100644
--- a/addons/website_slides/controllers/main.py
+++ b/addons/website_slides/controllers/main.py
@@ -293,9 +293,11 @@ class WebsiteSlides(http.Controller):
@http.route(['/slides/add_slide'], type='json', auth='user', methods=['POST'], website=True)
def create_slide(self, *args, **post):
- file_size = len(post['datas']) * 3 / 4; # base64
- if (file_size / 1024.0 / 1024.0) > 25:
- return {'error': _('File is too big. File size cannot exceed 25MB')}
+ # check the size only when we upload a file.
+ if post.get('datas'):
+ file_size = len(post['datas']) * 3 / 4 # base64
+ if (file_size / 1024.0 / 1024.0) > 25:
+ return {'error': _('File is too big. File size cannot exceed 25MB')}
values = dict((fname, post[fname]) for fname in [
'name', 'url', 'tag_ids', 'slide_type', 'channel_id',