File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -327,7 +327,7 @@ public function detect_rewrite_endpoint( $should_parse_request ) {
327
327
}
328
328
329
329
$ amp_slug = amp_get_slug ();
330
- $ pattern = sprintf ( '#( /%s) (?=/?(\?.*)?$)# ' , preg_quote ( $ amp_slug , '# ' ) );
330
+ $ pattern = sprintf ( ': /%s(?=/?(\?|$)): ' , preg_quote ( $ amp_slug , ': ' ) );
331
331
332
332
// Detect and purge the AMP endpoint from the request.
333
333
foreach ( [ 'REQUEST_URI ' , 'PATH_INFO ' ] as $ var ) {
@@ -873,8 +873,8 @@ public function has_paired_endpoint( $url = '' ) {
873
873
874
874
if ( ! $ has_endpoint && ! empty ( $ parsed_url ['path ' ] ) ) {
875
875
$ pattern = sprintf (
876
- '# /%s(/[^/^])?/?$# ' ,
877
- preg_quote ( $ slug , '# ' )
876
+ ': /%s/?$: ' ,
877
+ preg_quote ( $ slug , ': ' )
878
878
);
879
879
if ( preg_match ( $ pattern , $ parsed_url ['path ' ] ) ) {
880
880
$ has_endpoint = true ;
@@ -906,10 +906,10 @@ public function has_paired_endpoint( $url = '' ) {
906
906
public function remove_paired_endpoint ( $ url ) {
907
907
$ slug = amp_get_slug ();
908
908
909
- // Strip endpoint, including /amp/, /amp/amp/, /amp/foo/ .
909
+ // Strip endpoint suffix .
910
910
$ non_amp_url = preg_replace (
911
911
sprintf (
912
- ':( /%s(/[^/?#]+)?)+ (?=/?(\?|#|$)): ' ,
912
+ ':/%s(?=/?(\?|#|$)): ' ,
913
913
preg_quote ( $ slug , ': ' )
914
914
),
915
915
'' ,
You can’t perform that action at this time.
0 commit comments