New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix AMP version comment pages URL for legacy paired URL structure. #6389
Conversation
Plugin builds for d769474 are ready 🛎️!
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @dhaval-parekh! Just a few minor changes to be made.
Co-authored-by: Pierre Gordon <16200219+pierlon@users.noreply.github.com>
Co-authored-by: Pierre Gordon <16200219+pierlon@users.noreply.github.com>
Co-authored-by: Pierre Gordon <16200219+pierlon@users.noreply.github.com>
Co-authored-by: Pierre Gordon <16200219+pierlon@users.noreply.github.com>
…tion to legacy reader
…for cpage query var
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…legacy-reader-paired-url * 'develop' of github.com:ampproject/amp-wp: (56 commits) Fix path regex for QA plugin workflow Fix script path Fix syntax error Also apply modified paths restrictions for QA tester plugin workflow Fix patterns Only run jobs when related files are modified Rename step Update Gutenberg package dependencies Omit Bento from components when version is not valid Update spec to include ampproject/amphtml#34769 Update Gutenberg package dependencies Set null state Require polyfill directly Replace deprecated `@babel/polyfill` with `@wordpress/babel-preset-default/build/polyfill` Parse result into array Close latest Gutenberg dependency update PR if it is outdated Enable auto merge if needed Remove dependency approve list Switch to `google-github-actions/setup-gcloud` action Fix lint error ...
…redirect_canonical filters have fixed URL
…legacy-reader-paired-url * 'develop' of github.com:ampproject/amp-wp: Bump grunt from 1.4.0 to 1.4.1 in /qa-tester Bump codecov/codecov-action from 1.5.0 to 1.5.2 Bump cweagans/composer-patches from 1.7.0 to 1.7.1 Bump @wordpress/eslint-plugin from 9.0.5 to 9.0.6 in /qa-tester Bump eslint from 7.26.0 to 7.28.0 Bump grunt from 1.4.0 to 1.4.1 Bump php-stubs/wordpress-stubs from 5.7.1 to 5.7.2 Bump google/cloud-storage from 1.23.1 to 1.23.2 Bump postcss-loader from 4.2.0 to 4.3.0
$post_id = $this->url_to_postid( $url ); | ||
// Make sure any existing AMP endpoint is removed. | ||
$url = $this->remove_endpoint( $url ); | ||
|
||
$post_id = $this->url_to_postid( $url ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously when an AMP endpoint was being supplied, $post_id
would always be 0
since it wouldn't be recognized. So removing the endpoint first ensures that url_to_postid
works as expected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added the missing assertions which would have caught this in 28b3fbf.
c7c9d03
to
28b3fbf
Compare
$this->assertEquals( | ||
trailingslashit( trailingslashit( $post_permalink_url ) . $slug ), | ||
$this->instance->add_endpoint( trailingslashit( $post_permalink_url ) . $slug ) | ||
); | ||
$this->assertEquals( 2, $amp_pre_get_permalink_count ); | ||
$this->assertEquals( 2, $amp_get_permalink_count ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before acf8a17 these assertions would fail.
Summary
To address the issue of invalid redirect for the AMP version comment page for legacy paired URL structure.
Fixes #6355
Checklist