From 8c6068fe2e9457489615379440f826500f809659 Mon Sep 17 00:00:00 2001 From: BlankEclair Date: Sun, 15 Sep 2024 12:47:19 +1000 Subject: [PATCH] Trim URL and API URLs when saving interwiki prefixes Bug: T374771 Change-Id: Iaddf64d3297db33098dd0c56f0661e2ba81f519e --- includes/SpecialInterwiki.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/includes/SpecialInterwiki.php b/includes/SpecialInterwiki.php index b384492e..56b8b6bc 100644 --- a/includes/SpecialInterwiki.php +++ b/includes/SpecialInterwiki.php @@ -298,8 +298,10 @@ class SpecialInterwiki extends SpecialPage { $prefix = $contLang->lc( $prefix ); // Fall through case 'edit': - $theurl = $data['url']; - $api = $data['api'] ?? ''; + // T374771: Trim the URL and API URLs to reduce confusion when + // the URLs are accidentally provided with extra whitespace + $theurl = trim( $data['url'] ); + $api = trim( $data['api'] ?? '' ); $local = $data['local'] ? 1 : 0; $trans = $data['trans'] ? 1 : 0; $rows = [