From cc4cbe80bc329e853303a55bec191a3e023c06e6 Mon Sep 17 00:00:00 2001 From: Volodymyr Kolesnykov Date: Fri, 18 Apr 2025 23:26:31 +0300 Subject: [PATCH] fix(dev-env): strip trailing slash in URLs when doing sync --- src/commands/dev-env-sync-sql.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/commands/dev-env-sync-sql.ts b/src/commands/dev-env-sync-sql.ts index a5aee6734..875dbec30 100644 --- a/src/commands/dev-env-sync-sql.ts +++ b/src/commands/dev-env-sync-sql.ts @@ -68,8 +68,9 @@ async function extractSiteUrls( sqlFile: string ): Promise< string[] > { return new Promise( ( resolve, reject ) => { const urls: Set< string > = new Set(); readInterface.on( 'line', line => { - const url = findSiteHomeUrl( line ); + let url = findSiteHomeUrl( line ); if ( url ) { + url = url.replace( /\/$/, '' ); urls.add( url ); } } ); @@ -209,7 +210,7 @@ export class DevEnvSyncSQLCommand { const url = site?.homeUrl; if ( ! url ) continue; - const strippedUrl = stripProtocol( url ); + const strippedUrl = stripProtocol( url ).replace( /\/$/, '' ); if ( ! this.searchReplaceMap[ strippedUrl ] ) continue; const domain = new URL( url ).hostname;