Problem/Motivation

Part of #3399840: [meta] Replace http urls with https urls of the respective sites in core
Unless specifically testing the 'http' protocol https should be used for URLs.

Steps to reproduce

git grep http://test.com

Proposed resolution

Change 'http' to 'https' for 'test.com' and 'www.test.com'.

Remaining tasks

Changes should be made with a script. Something like
git grep -l http://test.com | xargs sed -i 's#http://test.com#https://test.com#g'. Post the commands used.
Run core/scripts/dev/commit-code-check.sh locally
Create MR

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3569457

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

quietone created an issue. See original summary.

quietone’s picture

Title: Replace http https for test.com and www.test.com » Replace http with https for test.com and www.test.com

sujal kshatri made their first commit to this issue’s fork.

sujal kshatri’s picture

replaced http://test.com and http://www.test.com with their https equivalents.

Changes were made using the following commands:

git grep -l http://test.com | xargs sed -i 's#http://test.com#https://test.com#g'
git grep -l http://www.test.com | xargs sed -i 's#http://www.test.com#https://www.test.com#g'

After applying the changes, running:

git grep http://test.com
git grep http://www.test.com

returned no results.

sujal kshatri’s picture

Status: Active » Needs review
sujal kshatri’s picture

testUrlFilterContent is getting failed

Filter Kernel (Drupal\Tests\filter\Kernel\FilterKernel)
✔ Align filter
✔ Caption filter
✔ Align and caption filters
✔ Line break filter
✔ Line break filter twig debug
✔ Html filter
✔ No follow filter
✔ Html escape filter
✔ Url filter
✘ Url filter content

i am not able to understand why this test is failing,
i need some guidance as to how to fix this

dcam’s picture

Status: Needs review » Needs work

The problem is in core/modules/filter/tests/filter.url-output.txt. This file represents what a block of text should look like after the filter module has acted on it. One of the applied filters turns URLs that are written in the text into anchor links. If a URL does not have a scheme (http:// or https://), then it will prepend "http://" to its URL in the anchor. You replaced all of these with https://, so the expected text no longer matches.

sujal kshatri’s picture

Thanks for explaining, which means I should only fix the test output by changing the https:// links back to http:// in filter.url-output.txt?
Does filter.url-input.txt file also need a change?

dcam’s picture

...which means I should only fix the test output by changing the https:// links back to http:// in filter.url-output.txt?

Correct.

quietone’s picture

@sujal kshatri, thanks for working on this. Are you willing to try again?

I think there is a misunderstanding here. The file filter.url-output.txt does need to be changed because the input file for the test, core/modules/filter/tests/src/Kernel/FilterKernelTest.php, changed. But not all instances of http should be changed to https. So, which ones to change? The ones that have a protocol in the link text.

For example, <a href="http://www.test.com">www.test.com</a> does not change but <a href="http://www.test.com">http://www.test.com</a> changes to <code><a href="https://www.test.com">https://www.test.com</a>

sujal kshatri’s picture

Oh, so that was where i was going wrong
I'll make the changes

sujal kshatri’s picture

I did it manually for filter.url-output.txt, no grep commands were used so if any of http still get left that needs a change then do let me know

sujal kshatri’s picture

Also there is a line in filter.url-output.txt

The old URL filter has problems with <a title="kind of link www.example.com with text" href="https://www.example.com">this kind of link</a> with www address as part of text in title.

earlier here it was http , i changed it to https , did i do the right thing ?

sujal kshatri’s picture

The old URL filter has problems with <a title="kind of link www.example.com with text" href="https://www.example.com">this kind of link</a> with www address as part of text in title.

i think here i should have kept it as http only because there's it doesn't have a protocol in the link text

sujal kshatri’s picture

Status: Needs work » Needs review

Finally the pipeline passed!!

dcam changed the visibility of the branch main to hidden.

dcam’s picture

Status: Needs review » Needs work

Thank you for your hard work, @sujal kshatri.

I searched core for any additional references to http:\/\/(www\.)?test\.com. I believe I found four more that need to be changed. I left suggestions for them in the MR. I'm setting the status to Needs Work for you to consider them.

sujal kshatri’s picture

Thank you so much for the review
Initially I did change them , but these were the reason the Filter Kernel was failing again and again , and also @quietone told to only change which have a protocol in link text, so i had to revert back, these 4 were the one i had doubt in.

sujal kshatri’s picture

The error was something like:-

✘ Url filter content
       ┐
       ├ Complex HTML document was correctly processed.  
       ├ Failed asserting that two strings are identical.
       ┊ ---·Expected
       ┊ +++·Actual
       ┊ @@ @@
       ┊ -Testing·code·tag·http://www.test.com·abc
       ┊ +Testing·code·tag·https://www.test.com·abc
       ┊

sujal kshatri’s picture

Just let me know if i should change these four as well, I'll happily make the changes ,I just want a final confirmation ,

dcam’s picture

I interpret @quietone's comment a little differently. URLs that aren't enclosed in anchor tags should still be changed. We just needed to be careful about what we do with the URLs that would be processed by the filter module. URLs wrapped in code tags or in comments should not be processed. We can go ahead and change them from http:// to https://.

For what it's worth, when I applied those four changes on my local environment and ran the FilterKernelTest it passed. You might apply the suggestions and give it a shot. If they don't work correctly, then they can always be reverted. I can try to help you figure out what went wrong with it too.

sujal kshatri’s picture

Applied the suggestions, Yours FilterKernelTest passed then i believe then it should work correctly, Thanks for the suggestions :)

sujal kshatri’s picture

Status: Needs work » Needs review

It worked!!! All green, Thank you so much for those suggestions, will be forever grateful

dcam’s picture

Status: Needs review » Reviewed & tested by the community

You've done a good job here, performing due diligence to ensure everything is working correctly and to accept feedback. Thank you for being a helpful contributor. Please keep up the good work!

And now for my part: I have verified that the only remaining instances of http:\/\/(www\.)?test.com in Core are those that are supposed to be there for testing the filter module. These changes look good to me.

dcam’s picture

Hit me up on the Drupal Slack if you need help finding another issue to work on.

quietone’s picture

Assigned: Unassigned » quietone

Assigning to myself to possible commit in 24 hours, it is too late in the day for me to do a proper review.

sujal kshatri’s picture

@dcam Thanks for positive review ,You were great too especially your helpfull nature, helping me with guidance and suggestions were very helpful, thanks to @quietone as well,
your slack id is @dcam right?

dcam’s picture

your slack id is @dcam right?

Yes

thirteenthdown made their first commit to this issue’s fork.

thirteenthdown’s picture

Status: Reviewed & tested by the community » Needs review

I have updated all occurrences of http://test.com and http://www.test.com to https across the codebase. As instructed, I explicitly excluded the vendor/ and node_modules/ directories.

quietone’s picture

@thirteenthdown, Welcome! The status of this issue was 'RTBC' when you started working on it. That means that this was reviewed and tested by the community and considered ready for commit. At this stage, the issue does not need another Merge Request. Your work is duplicating the work done by @sujal kshatri. Before working on an issue it is expected that all contributors read the issue summary and comments to understand what needs to be done. That allows us to build on each other work and not duplicate work.

As a new member of the community, I suggest you consult the Drupal Contributor Guide for tutorials on working on issues and other tasks in our community.

quietone changed the visibility of the branch 3569457-replace-http-with to hidden.

quietone’s picture

Status: Needs review » Reviewed & tested by the community

I am now going to hide the latest, duplicate MR, close it and restore the status of this which was set by a core subsystem maintainer.

  • quietone committed 96868a9c on 11.x
    task: #3569457 Replace http with https for test.com and www.test.com
    
    By...

  • quietone committed 8fa97ad2 on main
    task: #3569457 Replace http with https for test.com and www.test.com
    
    By...
quietone’s picture

Version: main » 11.x-dev
Assigned: quietone » Unassigned
Status: Reviewed & tested by the community » Fixed

@sujal kshatri, Thanks for continuing to work on this until it was RTBC! Commenting one what actions you took, including the commands, and questions, makes it easier for others to understand. And, as you can see we all have different ways of saying things, which can sometimes add confusion. Again, thanks for staying with this. And you detailed comments are most welcome in our community.

Committed to main and 11.x. Thanks!

I noted that the failing test is core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayBlockFormTest.php which is a know random failure, listed at #2829040: [meta] Known intermittent, random, and environment-specific test failures

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

thirteenthdown’s picture

Yes I directly jumped in doing MR @quietone as I believed and misinterpreted these issues to be an open mock issue for all the first timers. I wont repeat this thing again and will look forward to contribute the right way in future. Thanks )

quietone’s picture

@thirteenthdown, thanks for letting us know!

Status: Fixed » Closed (fixed)

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