Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
See #1642522: Using https version of profile image: The "profile image" views field is rendered using the http protocol. That issue committed a patch to strip the protocol from the views handler output.
I have noted that the same needs doing for the "formatted tweet" field. To save re-opening an old issue, I'll open a new one. I have a patch for it for 7.x-6.x first, and can easily backport to 7.x-5.x once we're agreed what is needed for 7.x-6.x. I've started there, rather than 8.x-1.x, because views handlers don't appear to have been ported to 8.x-1.x as yet.
Comment | File | Size | Author |
---|---|---|---|
#14 | twitter-n2675832-14.patch | 643 bytes | DamienMcKenna |
#7 | twitter_2675832-7.patch | 694 bytes | JamesOakley |
| |||
#4 | twitter_2675832-3.patch | 717 bytes | JamesOakley |
#2 | twitter_2675832-1.patch | 670 bytes | JamesOakley |
Comments
Comment #2
JamesOakleyAttached is a patch for this for 7.x-6.x, following the same approach as in the linked issue.
One comment is needed: This strips the protocol from the entire themed output; that will include the links to "retweet" etc., and also any outbound links within the tweet itself. This is not a problem, however, because both the domains twitter.com and t.co return identical content over https.
When it comes to patching 7.x-5.x, it should be noted that this identical patch works for that branch.
Comment #4
JamesOakleyOops. :blush:
It would help if I remembered to include the line that actually makes this patch do anything. The version from #1 was a mere placebo. Try again!
But why did the first patch fail to apply? Anyone see what I did wrong that - it runs fine through "patch" on my system.
Comment #5
JamesOakleyComment #7
JamesOakleyOK. I'm being slow this evening. It failed testing because I was on the wrong branch. Doh.
Here's one for the 7.x-6.x branch. Should pass tests.
Comment #8
holist CreditAttribution: holist at Siili Solutions commentedDoesn't this patch remove all "http:" strings from the tweet, because it runs str_replace on the whole themed output, and this is not image specific code? I don't think it is the intended result.
Comment #9
JamesOakleyYes. It does. But no, it's not a problem. See my comment when I first submitted a patch:
Perhaps I should elaborate. Twitter turn any linked content within a tweet into a short-link on the t.co domain. t.co returns identical content whether you access a link over https or http. If someone puts an http link into a tweet, you can still access the t.co short URL over https, and Twitter's URL shortener will resolve it to the original http link (I've just checked that). For this reason, if you actually browse twitter.com in a web browser, all the t.co links are now showing as https.
The only other links you'll get are on the twitter.com domain - links to retweet / a person's twitter homepage / etc. All of those also resolve fine over http and https.
So if every linked resource in a tweet was linked in a protocol-relative syntax, that will never pose a problem, and is the direction that Twitter themselves seem to be moving in for their own site.
I'll set this back to Needs Review. But if I've missed a problem with this, please explain in a bit more detail why we can't have every tweet resource served over https.
Comment #10
holist CreditAttribution: holist at Siili Solutions commentedOk, I wasn't aware that Twitter does this for everything under the hood, so to speak. I see no problem with the patch, RTBC in my view.
Comment #11
intrafusionI confirm this also works too, can we get this applied?
Comment #13
DamienMcKennaCommitted.
Comment #14
DamienMcKennaBackported to 7.x-5.x.
Comment #15
DamienMcKennaComment #17
DamienMcKennaCommitted to the 7.x-5.x branch. Thanks everyone.