Skip to content

Update CID to v1.3.1#21

Merged
cyberpower678 merged 3 commits intowikimedia:masterfrom
cyberpower678:master
Aug 18, 2017
Merged

Update CID to v1.3.1#21
cyberpower678 merged 3 commits intowikimedia:masterfrom
cyberpower678:master

Conversation

@cyberpower678
Copy link
Copy Markdown
Collaborator

This update makes the following changes:
*Pluses in the paths are not forcibly encoded to %2B. They are legal
characters in URLs
*Pluses in the queries are not forcibly encoded to %2B as %2B means a
literal plus, and the plus means a space.
*The idiot proof check now uses a sanity check to ensure the URL is
fully encoded to prevent accidental decoding of double URLs.

Tests:
*Added URL http://www.musicvf.com/Buck+Owens+%2526+Ringo+Starr.art
which came back dead with the algorithm.
*Added same URL to the sanitizing test to test new sanity check
*Removed a couple of now useless tests, where URLs returned are
identical to the input.

This update makes the following changes:
*Pluses in the paths are not forcibly encoded to %2B.  They are legal
characters in URLs
*Pluses in the queries are not forcibly encoded to %2B as %2B means a
literal plus, and the plus means a space.
*The idiot proof check now uses a sanity check to ensure the URL is
fully encoded to prevent accidental decoding of double URLs.

Tests:
*Added URL http://www.musicvf.com/Buck+Owens+%2526+Ringo+Starr.art
which came back dead with the algorithm.
*Added same URL to the sanitizing test to test new sanity check
*Removed a couple of now useless tests, where URLs returned are
identical to the input.
Fix code sniffer complaints.
@cyberpower678 cyberpower678 requested review from Niharika29, catrope and kaldari and removed request for catrope August 16, 2017 13:15
@cyberpower678
Copy link
Copy Markdown
Collaborator Author

Just a friendly bump. I would like to deploy this update before I launch a critical update to IABot.

Comment thread src/CheckIfDead.php Outdated
// Reattach the fragment
if ( !is_null( $fragment ) ) {
$url .= "#$fragment";
// Make sure URL is fully encoded by checking if the :// is encoded.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is confusing. It makes it sound like we expect all URLs passed to parseURL() to be URL-encoded. I imagine you mean to say something like "See if the URL is fully encoded by checking if the :// is encoded."

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an existing comment.

Comment thread src/CheckIfDead.php
// This avoids possible 400 Bad Response errors.
$url .= "/";
if ( isset( $parts['path'] ) && strlen( $parts['path'] ) > 1 ) {
$parts['path'] = str_replace( "+", "CHECKIFDEADPLUSSPACE", $parts['path'] );
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment explaining why we need to worry about pluses in the path (and possibly add an example URL)?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can add the comment but the URL is already in the test cases I modified.

Add comments per request of reviewer.
@cyberpower678
Copy link
Copy Markdown
Collaborator Author

@kaldari I made the requested changes.

Copy link
Copy Markdown
Collaborator

@kaldari kaldari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems OK.

@cyberpower678 cyberpower678 merged commit 2db1545 into wikimedia:master Aug 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants