Skip to content

Commit

Permalink
Move query_string fetching deeper in the logic
Browse files Browse the repository at this point in the history
  • Loading branch information
caldav authored Dec 5, 2023
1 parent 79142ad commit c590280
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions webapp/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -736,14 +736,12 @@ def dispatch_request(self, slug):
if "article" not in context:
return flask.abort(404)

# Capture the original query string
original_query_string = flask.request.query_string.decode("utf-8")

# Redirect canonical announcements
group = context["article"].get("group")
if isinstance(group, dict) and group["id"] == 2100:
redirect_url = f"https://canonical.com/blog/{slug}"
# Append the original query string to the redirect URL
original_query_string = flask.request.query_string.decode("utf-8")
if original_query_string:
redirect_url += f"?{original_query_string}"
return flask.redirect(redirect_url)
Expand Down

0 comments on commit c590280

Please sign in to comment.