This should hopefully fix redirect issue (Url normalization was the cause)

This commit is contained in:
Dylan 2023-07-02 15:58:43 +01:00
parent 3d8423db96
commit c89c575e0d

View File

@ -111,7 +111,11 @@ def twitfix(sub_path):
if match.start() == 0:
twitter_url = "https://twitter.com/" + sub_path
else:
twitter_url = "https://" + sub_path
# URL normalization messes up the URL, so we have to fix it
if sub_path.startswith("https:/"):
twitter_url = sub_path.replace("https:/", "https://", 1)
elif sub_path.startswith("http:/"):
twitter_url = sub_path.replace("http:/", "http://", 1)
if isValidUserAgent(user_agent):
res = embedCombined(twitter_url)