Skip to content

Commit

Permalink
Merge branch 'develop' into trunk
Browse files Browse the repository at this point in the history
  • Loading branch information
dkotter committed Jun 1, 2023
2 parents 80ddd93 + 1a6c9a0 commit 8d134b6
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 10 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file, per [the Ke

## [Unreleased] - TBD

## [2.0.1] - 2023-06-01
### Fixed
- Ensure our E2E tests run (props [@Sidsector9](https://github.com/Sidsector9), [@iamdharmesh](https://github.com/iamdharmesh) via [#318](https://github.com/10up/safe-redirect-manager/pull/318)).
- Ensure the `message` array key exists before we use it (props [@dkotter](https://github.com/dkotter), [@ocean90](https://github.com/ocean90), [@vena](https://github.com/vena), [@peterwilsoncc](https://github.com/peterwilsoncc) via [#319](https://github.com/10up/safe-redirect-manager/pull/319)).
- Resolve deprecation notices in PHP 8.1 and later (props [@peterwilsoncc](https://github.com/peterwilsoncc), [@dkotter](https://github.com/dkotter) via [#322](https://github.com/10up/safe-redirect-manager/pull/322)).

## [2.0.0] - 2023-05-31
**Note that this version bumps the PHP minimum from 5.6 to 7.4 and the WordPress minimum from 4.6 to 5.7.**

Expand Down Expand Up @@ -272,6 +278,7 @@ All notable changes to this project will be documented in this file, per [the Ke
- Plugin released

[Unreleased]: https://github.com/10up/safe-redirect-manager/compare/trunk...develop
[2.0.1]: https://github.com/10up/safe-redirect-manager/compare/2.0.0...2.0.1
[2.0.0]: https://github.com/10up/safe-redirect-manager/compare/1.11.1...2.0.0
[1.11.1]: https://github.com/10up/safe-redirect-manager/compare/1.11.0...1.11.1
[1.11.0]: https://github.com/10up/safe-redirect-manager/compare/1.10.1...1.11.0
Expand Down
2 changes: 1 addition & 1 deletion CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The following individuals are responsible for curating the list of issues, respo

Thank you to all the people who have already contributed to this repository via bug reports, code, design, ideas, project management, translation, testing, etc.

[Taylor Lovett (@tlovett1)](https://github.com/tlovett1), [Zack Tollman (@tollmanz)](https://github.com/tollmanz), [Taylor Dewey (@tddewey)](https://github.com/tddewey), [10up (@10up)](https://github.com/10up), [Jake Goldman (@jakemgold)](https://github.com/jakemgold), [Daniel Bachhuber (@danielbachhuber)](https://github.com/danielbachhuber), [VentureBeat (@VentureBeat)](https://github.com/VentureBeat), [Jeffrey Paul (@jeffpaul)](https://github.com/jeffpaul), [Tom J Nowell (@tomjn)](https://github.com/tomjn), [Helen Hou-Sandi (@helen)](https://github.com/helen), [Simon Wheatley (@simonwheatley)](https://github.com/simonwheatley), [Davis Shaver (@davisshaver)](https://github.com/davisshaver), [Tauno Hogue (@tauno)](https://github.com/tauno), [Eugene Manuilov (@eugene-manuilov)](https://github.com/eugene-manuilov), [Chris Marslender (@cmmarslender)](https://github.com/cmmarslender), [Benoît Chantre (@benoitchantre)](https://github.com/benoitchantre), [Viktor Szépe (@szepeviktor)](https://github.com/szepeviktor), [Molnár Éva (@milli05)](https://github.com/milli05), [Henrique Mouta (@vaurdan)](https://github.com/vaurdan), [Raymond Ware (@raymondware)](https://github.com/raymondware), [Kevin Langley Jr (@kevinlangleyjr)](https://github.com/kevinlangleyjr), [Justin Sternberg (@jtsternberg)](https://github.com/jtsternberg), [Francesco Laffi (@francescolaffi)](https://github.com/francescolaffi), [Scott Walkinshaw (@swalkinshaw)](https://github.com/swalkinshaw), [Rebecca Hum (@rebeccahum)](https://github.com/rebeccahum), [Peter Sorensen (@psorensen)](https://github.com/psorensen), [Tyrel Kelsey (@ninnypants)](https://github.com/ninnypants), [Lucy Tomás (@lucymtc)](https://github.com/lucymtc), [Luca Speranza (@lucspe)](https://github.com/lucspe), [Luke Gedeon (@lgedeon)](https://github.com/lgedeon), [Josh Betz (@joshbetz)](https://github.com/joshbetz), [Jeremy Felt (@jeremyfelt)](https://github.com/jeremyfelt), [James Burke (@jameswburke)](https://github.com/jameswburke), [@inathani](https://github.com/inathani), [Ulrich Pogson (@grappler)](https://github.com/grappler), [Chancey Mathews (@chanceymathews)](https://github.com/chanceymathews), [Ramon van Belzen (@Ramoonus)](https://github.com/Ramoonus), [Adam Silverstein (@adamsilverstein)](https://github.com/adamsilverstein), [Linnea Huxford (@mslinnea)](https://github.com/mslinnea), [Jon Sherrard (@jonsherrard)](https://github.com/jonsherrard), Jean-Christophe Brebion, [Michael Pretty (@prettyboymp)](https://github.com/prettyboymp), [Armando Lüscher (@noplanman)](https://github.com/noplanman), [Nícholas André (@nicholasio)](https://github.com/nicholasio), [Tung Du (@dinhtungdu)](https://github.com/dinhtungdu), [Noeste IJver (@noesteijver)](https://github.com/noesteijver), [David Greenwald (@davidegreenwald)](https://github.com/davidegreenwald), [GitHub Dependabot (@dependabot)](https://github.com/apps/dependabot), [Lea Alcantara (@lea10up)](https://github.com/lea10up), [Amy Evans (@amyevans)](https://github.com/amyevans), [Jeffrey Betts (@jeffreybetts)](https://github.com/jeffreybetts), [Barry Ceelen (@barryceelen)](https://github.com/barryceelen), [Caleb Burks (@WPprodigy)](https://github.com/WPprodigy), [Bradley Taylor (@braders)](https://github.com/braders), [James Morrison (@jamesmorrison)](https://github.com/jamesmorrison), [Pop VeKind (@PopVeKind)](https://github.com/PopVeKind), [Vincent Klaiber (@vinkla)](https://github.com/vinkla), [Ankit K Gupta (@ankitguptaindia)](https://github.com/ankitguptaindia), [Jeffrey Carandang (@phpbits)](https://github.com/phpbits), [Zachary Brown (@TheLastCicada)](https://github.com/TheLastCicada), [MD Sultan Nasir Uddin (@sultann)](https://github.com/sultann), [@jilltilt](https://github.com/jilltilt), [@yeevy](https://github.com/yeevy), [David Mondok (@davidmondok)](https://github.com/davidmondok), [Darin Kotter (@dkotter)](https://github.com/dkotter), [Dhanendran (@dhanendran)](https://github.com/dhanendran), [Dharmesh Patel (@iamdharmesh)](https://github.com/iamdharmesh), [Lukas Pawlik (@lukaspawlik)](https://github.com/lukaspawlik), [Michael Ilett (@hrkhal)](https://github.com/hrkhal), [Peter Wilson (@peterwilsoncc)](https://github.com/peterwilsoncc), [Sanket Parmar (@sanketio)](https://github.com/sanketio), [Siddharth Thevaril (@Sidsector9)](https://github.com/Sidsector9), [Sudip Dadhaniya (@sudip-10up)](https://github.com/sudip-10up), [Nate Conley (@nateconley)](https://github.com/nateconley), [Max Lyuchin (@cadic)](https://github.com/cadic), [Dustin Rue (@dustinrue)](https://github.com/dustinrue), [Michele Cipriani (@ciprianimike)](https://github.com/ciprianimike), [Alex Osmichenko (@aosmichenko)](https://github.com/aosmichenko), [Oka Tai-Lee (@okadots)](https://github.com/okadots), [Jayedul Kabir (@jayedul)](https://github.com/jayedul), [Faisal Alvi (@faisal-alvi)](https://github.com/faisal-alvi), [Curtis Loisel (@csloisel)](https://github.com/csloisel), [Vikram Moparthy (@vikrampm1)](https://github.com/vikrampm1), [Andrew Norcross (@norcross)](https://github.com/norcross), [Giorgos Sarigiannidis (@gsarig)](https://github.com/gsarig), [David Chandra Purnama (@turtlepod)](https://github.com/turtlepod).
[Taylor Lovett (@tlovett1)](https://github.com/tlovett1), [Zack Tollman (@tollmanz)](https://github.com/tollmanz), [Taylor Dewey (@tddewey)](https://github.com/tddewey), [10up (@10up)](https://github.com/10up), [Jake Goldman (@jakemgold)](https://github.com/jakemgold), [Daniel Bachhuber (@danielbachhuber)](https://github.com/danielbachhuber), [VentureBeat (@VentureBeat)](https://github.com/VentureBeat), [Jeffrey Paul (@jeffpaul)](https://github.com/jeffpaul), [Tom J Nowell (@tomjn)](https://github.com/tomjn), [Helen Hou-Sandi (@helen)](https://github.com/helen), [Simon Wheatley (@simonwheatley)](https://github.com/simonwheatley), [Davis Shaver (@davisshaver)](https://github.com/davisshaver), [Tauno Hogue (@tauno)](https://github.com/tauno), [Eugene Manuilov (@eugene-manuilov)](https://github.com/eugene-manuilov), [Chris Marslender (@cmmarslender)](https://github.com/cmmarslender), [Benoît Chantre (@benoitchantre)](https://github.com/benoitchantre), [Viktor Szépe (@szepeviktor)](https://github.com/szepeviktor), [Molnár Éva (@milli05)](https://github.com/milli05), [Henrique Mouta (@vaurdan)](https://github.com/vaurdan), [Raymond Ware (@raymondware)](https://github.com/raymondware), [Kevin Langley Jr (@kevinlangleyjr)](https://github.com/kevinlangleyjr), [Justin Sternberg (@jtsternberg)](https://github.com/jtsternberg), [Francesco Laffi (@francescolaffi)](https://github.com/francescolaffi), [Scott Walkinshaw (@swalkinshaw)](https://github.com/swalkinshaw), [Rebecca Hum (@rebeccahum)](https://github.com/rebeccahum), [Peter Sorensen (@psorensen)](https://github.com/psorensen), [Tyrel Kelsey (@ninnypants)](https://github.com/ninnypants), [Lucy Tomás (@lucymtc)](https://github.com/lucymtc), [Luca Speranza (@lucspe)](https://github.com/lucspe), [Luke Gedeon (@lgedeon)](https://github.com/lgedeon), [Josh Betz (@joshbetz)](https://github.com/joshbetz), [Jeremy Felt (@jeremyfelt)](https://github.com/jeremyfelt), [James Burke (@jameswburke)](https://github.com/jameswburke), [@inathani](https://github.com/inathani), [Ulrich Pogson (@grappler)](https://github.com/grappler), [Chancey Mathews (@chanceymathews)](https://github.com/chanceymathews), [Ramon van Belzen (@Ramoonus)](https://github.com/Ramoonus), [Adam Silverstein (@adamsilverstein)](https://github.com/adamsilverstein), [Linnea Huxford (@mslinnea)](https://github.com/mslinnea), [Jon Sherrard (@jonsherrard)](https://github.com/jonsherrard), Jean-Christophe Brebion, [Michael Pretty (@prettyboymp)](https://github.com/prettyboymp), [Armando Lüscher (@noplanman)](https://github.com/noplanman), [Nícholas André (@nicholasio)](https://github.com/nicholasio), [Tung Du (@dinhtungdu)](https://github.com/dinhtungdu), [Noeste IJver (@noesteijver)](https://github.com/noesteijver), [David Greenwald (@davidegreenwald)](https://github.com/davidegreenwald), [GitHub Dependabot (@dependabot)](https://github.com/apps/dependabot), [Lea Alcantara (@lea10up)](https://github.com/lea10up), [Amy Evans (@amyevans)](https://github.com/amyevans), [Jeffrey Betts (@jeffreybetts)](https://github.com/jeffreybetts), [Barry Ceelen (@barryceelen)](https://github.com/barryceelen), [Caleb Burks (@WPprodigy)](https://github.com/WPprodigy), [Bradley Taylor (@braders)](https://github.com/braders), [James Morrison (@jamesmorrison)](https://github.com/jamesmorrison), [Pop VeKind (@PopVeKind)](https://github.com/PopVeKind), [Vincent Klaiber (@vinkla)](https://github.com/vinkla), [Ankit K Gupta (@ankitguptaindia)](https://github.com/ankitguptaindia), [Jeffrey Carandang (@phpbits)](https://github.com/phpbits), [Zachary Brown (@TheLastCicada)](https://github.com/TheLastCicada), [MD Sultan Nasir Uddin (@sultann)](https://github.com/sultann), [@jilltilt](https://github.com/jilltilt), [@yeevy](https://github.com/yeevy), [David Mondok (@davidmondok)](https://github.com/davidmondok), [Darin Kotter (@dkotter)](https://github.com/dkotter), [Dhanendran (@dhanendran)](https://github.com/dhanendran), [Dharmesh Patel (@iamdharmesh)](https://github.com/iamdharmesh), [Lukas Pawlik (@lukaspawlik)](https://github.com/lukaspawlik), [Michael Ilett (@hrkhal)](https://github.com/hrkhal), [Peter Wilson (@peterwilsoncc)](https://github.com/peterwilsoncc), [Sanket Parmar (@sanketio)](https://github.com/sanketio), [Siddharth Thevaril (@Sidsector9)](https://github.com/Sidsector9), [Sudip Dadhaniya (@sudip-10up)](https://github.com/sudip-10up), [Nate Conley (@nateconley)](https://github.com/nateconley), [Max Lyuchin (@cadic)](https://github.com/cadic), [Dustin Rue (@dustinrue)](https://github.com/dustinrue), [Michele Cipriani (@ciprianimike)](https://github.com/ciprianimike), [Alex Osmichenko (@aosmichenko)](https://github.com/aosmichenko), [Oka Tai-Lee (@okadots)](https://github.com/okadots), [Jayedul Kabir (@jayedul)](https://github.com/jayedul), [Faisal Alvi (@faisal-alvi)](https://github.com/faisal-alvi), [Curtis Loisel (@csloisel)](https://github.com/csloisel), [Vikram Moparthy (@vikrampm1)](https://github.com/vikrampm1), [Andrew Norcross (@norcross)](https://github.com/norcross), [Giorgos Sarigiannidis (@gsarig)](https://github.com/gsarig), [David Chandra Purnama (@turtlepod)](https://github.com/turtlepod), [Dominik Schilling (@ocean90)](https://github.com/ocean90), [Daniel Vena (@vena)](https://github.com/vena).

## Libraries

Expand Down
9 changes: 7 additions & 2 deletions inc/classes/class-srm-post-type.php
Original file line number Diff line number Diff line change
Expand Up @@ -689,13 +689,18 @@ public function load_resources() {
* @return void
*/
public function srm_validate_from_url() {
$_wpnonce = filter_input( INPUT_GET, '_wpnonce', FILTER_SANITIZE_STRING );
if ( ! isset( $_GET['_wpnonce'] ) || ! isset( $_GET['from'] ) ) {
echo 0;
die();
}

$_wpnonce = sanitize_text_field( wp_unslash( $_GET['_wpnonce'] ) );
if ( ! wp_verify_nonce( $_wpnonce, 'srm-save-redirect-meta' ) ) {
echo 0;
die();
}

$from = filter_input( INPUT_GET, 'from', FILTER_SANITIZE_STRING );
$from = srm_sanitize_redirect_from( wp_unslash( $_GET['from'] ) );

/**
* SRM treats '/sample-page' and 'sample-page' equally.
Expand Down
2 changes: 1 addition & 1 deletion inc/classes/class-srm-redirect.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public function match_redirect( $requested_path ) {
$status_code = $redirect['status_code'];
$enable_regex = ( isset( $redirect['enable_regex'] ) ) ? $redirect['enable_regex'] : false;
$redirect_id = $redirect['ID'];
$message = $redirect['message'];
$message = $redirect['message'] ?? '';

// check if the redirection destination is valid, otherwise just skip it (unless this is a 4xx request)
if ( empty( $redirect_to ) && ! in_array( $status_code, array( 403, 404, 410 ), true ) ) {
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "safe-redirect-manager",
"version": "2.0.0",
"version": "2.0.1",
"description": "Easily and safely manage HTTP redirects.",
"homepage": "https://github.com/10up/safe-redirect-manager",
"bugs": {
Expand Down
7 changes: 6 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Tags: http redirects, redirect manager, url redirection, safe http
Requires at least: 5.7
Tested up to: 6.2
Requires PHP: 7.4
Stable tag: 2.0.0
Stable tag: 2.0.1
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -53,6 +53,11 @@ This should be a path (i.e. `/test`) or a URL (i.e. `http://example.com/wp/test`

== Changelog ==

= 2.0.1 - 2023-06-01 =
* **Fixed:** Ensure our E2E tests run (props [@Sidsector9](https://github.com/Sidsector9), [@iamdharmesh](https://github.com/iamdharmesh) via [#318](https://github.com/10up/safe-redirect-manager/pull/318)).
* **Fixed:** Ensure the `message` array key exists before we use it (props [@dkotter](https://github.com/dkotter), [@ocean90](https://github.com/ocean90), [@peterwilsoncc](https://github.com/peterwilsoncc) via [#319](https://github.com/10up/safe-redirect-manager/pull/319)).
* **Fixed:** Resolve deprecation notices in PHP 8.1 and later (props [@peterwilsoncc](https://github.com/peterwilsoncc), [@dkotter](https://github.com/dkotter) via [#322](https://github.com/10up/safe-redirect-manager/pull/322)).

= 2.0.0 - 2023-05-31 =
**Note that this version bumps the PHP minimum from 5.6 to 7.4 and the WordPress minimum from 4.6 to 5.7.**

Expand Down
4 changes: 2 additions & 2 deletions safe-redirect-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Safe Redirect Manager
* Plugin URI: https://wordpress.org/plugins/safe-redirect-manager
* Description: Easily and safely manage HTTP redirects.
* Version: 2.0.0
* Version: 2.0.1
* Requires at least: 5.7
* Requires PHP: 7.4
* Author: 10up
Expand All @@ -20,7 +20,7 @@
require_once dirname( __FILE__ ) . '/inc/classes/class-srm-post-type.php';
require_once dirname( __FILE__ ) . '/inc/classes/class-srm-redirect.php';

define( 'SRM_VERSION', '2.0.0' );
define( 'SRM_VERSION', '2.0.1' );

if ( defined( 'WP_CLI' ) && WP_CLI ) {
require_once dirname( __FILE__ ) . '/inc/classes/class-srm-wp-cli.php';
Expand Down
15 changes: 15 additions & 0 deletions tests/cypress/integration/safe-redirect-manager.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,21 @@ describe('Test redirect rules', () => {
cy.verifyEndpointDead('wildcard-403-test/1', 'Test message for a 403 wildcard');
});

it('Can not create a duplicate redirect rule', () => {
cy.createRedirectRule(
'/duplicate-rule-test/',
'/hello-world/',
'Rule for testing duplicate rule creation.'
);

cy.visit('/wp-admin/post-new.php?post_type=redirect_rule');

cy.get('#srm_redirect_rule_from').click().clear().type('/duplicate-rule-test/');
cy.get('#srm_redirect_rule_to').click();

cy.get('.notice-error').should('contain', 'There is an existing redirect with the same Redirect From URL.');
});

it('Can die with a 403 header', () => {
cy.createRedirectRule(
'/403-test',
Expand Down

0 comments on commit 8d134b6

Please sign in to comment.