Skip to content

Commit

Permalink
Fix acquisition url shortener based on failed test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
pedoch committed Nov 2, 2023
1 parent 6a7a028 commit 1983741
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions webapp/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -845,11 +845,15 @@ def shorten_acquisition_url(acquisition_url):
url_without_params = acquisition_url.split("?")[0]
url_params_string = acquisition_url.split("?")[1]
url_params_list = url_params_string.split("&")
url_params_to_remove = []

# Check for and remove fbclid and gclid parameters
for param in url_params_list:
if param.startswith("fbclid") or param.startswith("gclid"):
url_params_list.remove(param)
url_params_to_remove.append(param)

for param in url_params_to_remove:
url_params_list.remove(param)

new_acquisition_url = (
url_without_params + "?" + "&".join(url_params_list)
Expand All @@ -860,7 +864,6 @@ def shorten_acquisition_url(acquisition_url):
return new_acquisition_url.split("?")[0]

return new_acquisition_url

return acquisition_url


Expand Down

0 comments on commit 1983741

Please sign in to comment.