Support /status URLs

This commit is contained in:
Dylan 2024-05-04 22:25:16 +01:00
parent 84fe24092e
commit 116155f31a
2 changed files with 7 additions and 1 deletions

View File

@ -169,4 +169,8 @@ def test_embed_poll():
def test_embed_stripLastUrl():
resp = client.get(testMediaTweet.replace("https://twitter.com",""),headers={"User-Agent":"test"})
assert resp.status_code==200
assert "HgLAbiXw2E" not in str(resp.data)
assert "HgLAbiXw2E" not in str(resp.data)
def test_embed_no_username():
resp = client.get(testMediaTweet.replace("/pdxdylan",""),headers={"User-Agent":"test"})
assert resp.status_code==200

View File

@ -145,6 +145,8 @@ def determineEmbedTweet(tweetData):
@app.route('/<path:sub_path>') # Default endpoint used by everything
def twitfix(sub_path):
if sub_path.startswith("status/"): # support for /status/1234567890 URLs
sub_path = "i/" + sub_path
match = pathregex.search(sub_path)
if match is None:
abort(404)