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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

JamesOakley created an issue. See original summary.

JamesOakley’s picture

Status: Active » Needs review
FileSize
670 bytes

Attached 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.

Status: Needs review » Needs work

The last submitted patch, 2: twitter_2675832-1.patch, failed testing.

JamesOakley’s picture

Oops. :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.

JamesOakley’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 4: twitter_2675832-3.patch, failed testing.

JamesOakley’s picture

Status: Needs work » Needs review
FileSize
694 bytes

OK. 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.

holist’s picture

Status: Needs review » Needs work

Doesn'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.

JamesOakley’s picture

Status: Needs work » Needs review

Doesn'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.

Yes. It does. But no, it's not a problem. See my comment when I first submitted a patch:

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.

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.

holist’s picture

Status: Needs review » Reviewed & tested by the community

Ok, 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.

intrafusion’s picture

I confirm this also works too, can we get this applied?

DamienMcKenna’s picture

Status: Reviewed & tested by the community » Fixed

Committed.

DamienMcKenna’s picture

Version: 7.x-6.x-dev » 7.x-5.x-dev
Status: Fixed » Needs review
Parent issue: » #2572749: Plan for Twitter v7.x-6.2 release
Related issues: +#2580279: Plan for Twitter v7.x-5.12 release
FileSize
643 bytes

Backported to 7.x-5.x.

DamienMcKenna’s picture

Status: Needs review » Needs work

The last submitted patch, 14: twitter-n2675832-14.patch, failed testing.

DamienMcKenna’s picture

Status: Needs work » Fixed

Committed to the 7.x-5.x branch. Thanks everyone.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.