From df163bd26f97cd4424300e7fa16e1d66d053a524 Mon Sep 17 00:00:00 2001 From: jamiebergen Date: Thu, 2 Mar 2017 22:07:42 -0800 Subject: [PATCH] Prevent trailing slash inconsistencies Removes trailing slash, if present, from $replace_url so that it is consistent with the format of $live_url prior to performing search replace. --- classes/class-revisr-db-import.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/classes/class-revisr-db-import.php b/classes/class-revisr-db-import.php index 1d915b60..0f607f62 100644 --- a/classes/class-revisr-db-import.php +++ b/classes/class-revisr-db-import.php @@ -46,6 +46,8 @@ public function import_table_mysql( $table, $replace_url = '' ) { // Run a search replace if necessary. if ( $replace_url !== '' && $replace_url !== false ) { + // Remove trailing slash if present. + $replace_url = rtrim($replace_url, '/'); $this->revisr_srdb( $table, $replace_url, $live_url ); } @@ -87,6 +89,8 @@ public function import_table_wpdb( $table, $replace_url = '' ) { fclose( $fh ); if ( '' !== $replace_url ) { + // Remove trailing slash if present. + $replace_url = rtrim($replace_url, '/'); $this->revisr_srdb( $table, $replace_url, $live_url ); }