Improve Front Matter URL parsing, support Tweet IDs
IstoraMandiri opened this issue · comments
What happened?
It's common to expect users to be unaware that the URL needs to be perfectly formed, and may be copy and pasting from various environments, such as mobile, or from a browser that does not strip trackers from the URL.
After testing pull requests with various URLs passed to the retweet
option, the preview check returned "valid", but after merging the tweet failed to published.
What did you expect to happen?
The preview should fail if the URL is not formed correctly, or the publish action should parse the URL properly before retweeting it.
Additionally
An alternative approach is to ignore URLs entirely, and / or accept the Tweet ID.
---
retweet: 1575820698877980672
---
Tests
URL with Hash
IstoraMandiri/twitter-together-testing#8
PREVIEW PASSING: https://github.com/IstoraMandiri/twitter-together-testing/actions/runs/3168205724
PUBLISH FAILING: https://github.com/IstoraMandiri/twitter-together-testing/actions/runs/3168209652
---
retweet: https://twitter.com/testing_tt_/status/1576462993302372355#blah
---
URL with Mock Tracker
IstoraMandiri/twitter-together-testing#9
PREVIEW PASSING: https://github.com/IstoraMandiri/twitter-together-testing/actions/runs/3168218932
PUBLISH FAILING: https://github.com/IstoraMandiri/twitter-together-testing/actions/runs/3168219858
---
retweet: https://twitter.com/testing_tt_/status/1576508832418873349?cxt=xxx
---
URL with mobile
subdomain
IstoraMandiri/twitter-together-testing#10
PREVIEW PASSING: https://github.com/IstoraMandiri/twitter-together-testing/actions/runs/3168231352
PUBLISH FAILING: https://github.com/IstoraMandiri/twitter-together-testing/actions/runs/3168233222
---
retweet: https://mobile.twitter.com/testing_tt_/status/1575820698877980672
---
An alternative approach is to ignore URLs entirely, and / or accept the Tweet ID.
--- retweet: 1575820698877980672 ---
I'd prefer to have the full URL, it makes it easier to lookup the original tweet. But happy to be convinced otherwise. I see the benefit of only accepting IDs, and having a helpful error message in case an invalid value was provided.
I think the issue here is really just that we don't validate the URLs during preview -- the regex matching only happens during the tweet process currently:
Lines 16 to 17 in 66e7a86
Lines 38 to 39 in 66e7a86
Lines 47 to 48 in 66e7a86
I think we probably just need to validate URLs during preview and throw errors if they don't match the expected pattern.
yes I agree, let's do that, we can discuss changing what retweet
can be set to afterwards