diff options
| author | Frederick Muriuki Muriithi | 2025-12-18 10:54:27 -0600 |
|---|---|---|
| committer | Frederick Muriuki Muriithi | 2025-12-18 10:56:53 -0600 |
| commit | d04b7cb89b3fbaa1689f8f6525a2740eda7c3be3 (patch) | |
| tree | d5f9b04f81170b100e6cae66f7165cf549d0c5e6 /uploader/route_utils.py | |
| parent | 01ffc39815b2f15c8e3a6523799764372b12122a (diff) | |
| download | gn-uploader-d04b7cb89b3fbaa1689f8f6525a2740eda7c3be3.tar.gz | |
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"], |
