diff --git a/combo/apps/dataviz/views.py b/combo/apps/dataviz/views.py index a9955a01..cf319e08 100644 --- a/combo/apps/dataviz/views.py +++ b/combo/apps/dataviz/views.py @@ -41,8 +41,8 @@ def dataviz_graph(request, *args, **kwargs): error_text = None try: chart = cell.get_chart( - width=int(request.GET.get('width', 0)) or None, - height=int(request.GET.get('height', 0)) or int(cell.height) + width=int(request.GET['width']) if request.GET.get('width') else None, + height=int(request.GET['height']) if request.GET.get('height') else int(cell.height) ) except UnsupportedDataSet as e: error_text = _('Unsupported dataset.') diff --git a/tests/test_dataviz.py b/tests/test_dataviz.py index 6fc01251..3854569b 100644 --- a/tests/test_dataviz.py +++ b/tests/test_dataviz.py @@ -380,6 +380,9 @@ def test_chartng_cell_view(app, normal_user): resp = app.get('/api/dataviz/graph/1/?width=400') assert resp.content_type == 'image/svg+xml' + resp = app.get('/api/dataviz/graph/1/?width=') # no crash + assert resp.content_type == 'image/svg+xml' + page.public = False page.save() resp = app.get('/api/dataviz/graph/1/?width=400', status=403)