dataviz: don't crash on missing width value (#43726)
This commit is contained in:
parent
dfd35288fa
commit
f36306ceea
|
@ -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.')
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue