Describe the bug
If you set the value in the days input to a big number (e.g. 123123123) then you will get a 500 error.
You will get different errors based on how big the number is. 123123123 gives a DatetimeFieldOverflow with the message timestamp out of range. while 123123123123 gives an IntervalFieldOverflow error with the message
interval field value out of range: "123123123123.0 days"
LINE 17: ... WHERE acctstoptime > NOW()-interval '123123123...
To Reproduce
Steps to reproduce the behavior
- Go to
/radius/acctcharts
- Enter
123123123 into the Day(s) input box
- Click on
Show me
- See error
Expected behavior
If there is a logical limit to how big the number should be, then either the form shouldnt allow you to
click Show me until you enter a valid number, or an error should be shown saying something along the lines of Days must be between X and Y after you click the button.
If there shouldnt be a limit on how big the number can be, then it should work the same as it does with a smaller number.
Tracebacks
Environment:
Traceback (most recent call last):
File "/opt/venvs/nav/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/opt/venvs/nav/lib/python3.9/site-packages/django/core/handlers/base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/source/python/nav/web/radius/views.py", line 161, in account_charts
query.execute()
File "/source/python/nav/web/radius/db.py", line 56, in execute
cursor.execute(self.query, self.parameters)
Exception Type: DatetimeFieldOverflow at /radius/acctcharts
Exception Value: timestamp out of range
Traceback (most recent call last):
File "/opt/venvs/nav/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/opt/venvs/nav/lib/python3.9/site-packages/django/core/handlers/base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/source/python/nav/web/radius/views.py", line 161, in account_charts
query.execute()
File "/source/python/nav/web/radius/db.py", line 56, in execute
cursor.execute(self.query, self.parameters)
Exception Type: IntervalFieldOverflow at /radius/acctcharts
Exception Value: interval field value out of range: "123123123123.0 days"
LINE 17: ... WHERE acctstoptime > NOW()-interval '123123123...
Describe the bug
If you set the value in the
daysinput to a big number (e.g.123123123) then you will get a500error.You will get different errors based on how big the number is.
123123123gives aDatetimeFieldOverflowwith the messagetimestamp out of range. while123123123123gives anIntervalFieldOverflowerror with the messageTo Reproduce
Steps to reproduce the behavior
/radius/acctcharts123123123into theDay(s)input boxShow meExpected behavior
If there is a logical limit to how big the number should be, then either the form shouldnt allow you to
click
Show meuntil you enter a valid number, or an error should be shown saying something along the lines ofDays must be between X and Yafter you click the button.If there shouldnt be a limit on how big the number can be, then it should work the same as it does with a smaller number.
Tracebacks
Environment: