diff options
Diffstat (limited to 'uploader/route_utils.py')
| -rw-r--r-- | uploader/route_utils.py | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/uploader/route_utils.py b/uploader/route_utils.py index 4449475..fa63233 100644 --- a/uploader/route_utils.py +++ b/uploader/route_utils.py @@ -56,15 +56,17 @@ def generic_select_population( def redirect_to_next(default: dict): """Redirect to the next uri if specified, else redirect to default.""" assert "uri" in default, "You must provide at least the 'uri' value." - try: - next_page = base64_decode_to_dict(request.args.get("next")) - _uri = next_page["uri"] - next_page.pop("uri") - return redirect(url_for(_uri, **next_page)) - except (TypeError, JSONDecodeError) as _err: - logger.debug("We could not decode the next value '%s'", - next_page, - exc_info=True) + _next = request.args.get("next") + if bool(_next): + try: + next_page = base64_decode_to_dict(_next) + _uri = next_page["uri"] + next_page.pop("uri") + return redirect(url_for(_uri, **next_page)) + except (TypeError, JSONDecodeError) as _err: + logger.debug("We could not decode the next value '%s'", + next_page, + exc_info=True) return redirect(url_for( default["uri"], |
