From 116155f31a7459fdaaf62a60ad6be54a3fd3d323 Mon Sep 17 00:00:00 2001 From: Dylan Date: Sat, 4 May 2024 22:25:16 +0100 Subject: [PATCH] Support /status URLs --- test_vx_embeds.py | 6 +++++- twitfix.py | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/test_vx_embeds.py b/test_vx_embeds.py index df8c437..2f2808f 100644 --- a/test_vx_embeds.py +++ b/test_vx_embeds.py @@ -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) \ No newline at end of file + 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 \ No newline at end of file diff --git a/twitfix.py b/twitfix.py index 9fe45e5..e3d0b27 100644 --- a/twitfix.py +++ b/twitfix.py @@ -145,6 +145,8 @@ def determineEmbedTweet(tweetData): @app.route('/') # 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)