]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0553: runtime(netrw): netrw rejects hostnames containing _ v9.2.0553
authorChristian Brabandt <cb@256bit.org>
Thu, 28 May 2026 20:53:53 +0000 (20:53 +0000)
committerChristian Brabandt <cb@256bit.org>
Thu, 28 May 2026 20:56:48 +0000 (20:56 +0000)
Problem:  runtime(netrw): netrw rejects hostnames containing _
          (lilydjwg)
Solution: Relax the restriction and allow the underscore

fixes: #20344

Signed-off-by: Christian Brabandt <cb@256bit.org>
runtime/pack/dist/opt/netrw/autoload/netrw.vim
src/testdir/test_plugin_netrw.vim
src/version.c

index 89db6e3ca6041f9d296cc3b20ae2654f72eda1b7..f555d663174c773648ce255e7bd310f86003efbd 100644 (file)
@@ -1,7 +1,7 @@
 " Creator:    Charles E Campbell
 " Previous Maintainer: Luca Saccarola <github.e41mv@aleeas.com>
 " Maintainer: This runtime file is looking for a new maintainer.
-" Last Change: 2026 May 17
+" Last Change: 2026 May 28
 " Copyright:  Copyright (C) 2016 Charles E. Campbell {{{1
 "             Permission is hereby granted to use and distribute this code,
 "             with or without modifications, provided that this copyright
@@ -2581,8 +2581,8 @@ function s:NetrwValidateHostname(hostname)
   " Username:
   let user_pat = '\%([a-zA-Z0-9._-]\+@\)\?'
   " Hostname: 1-64 chars, alphanumeric/dots/hyphens.
-  " No underscores. No leading/trailing dots/hyphens.
-  let host_pat = '[a-zA-Z0-9]\%([-a-zA-Z0-9.]\{0,62}[a-zA-Z0-9]\)\?'
+  " No leading/trailing dots/hyphens.
+  let host_pat = '[a-zA-Z0-9_]\%([-a-zA-Z0-9._]\{0,62}[a-zA-Z0-9_]\)\?'
   " Port: 16 bit unsigned integer
   let port_pat = '\%(:\d\{1,5\}\)\?$'
 
index 76fa410921b3beb0f09905a7226b137a998cb11b..22477c68a8dab85784a7a8a8934af4b3caf623b3 100644 (file)
@@ -610,6 +610,7 @@ endfunc
 func Test_netrw_hostname()
   let valid_hostnames = [
   \   'localhost',
+  \   '_gateway',
   \   '127.0.0.1',
   \   '::1',
   \   '0:0:0:0:0:0:0:1',
index 6b91843f9cd9568fc50f47e45a48f7dc23a943b6..b7f9b8ed35d6ece8ab856bd82f21cd1c36bfa448 100644 (file)
@@ -729,6 +729,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    553,
 /**/
     552,
 /**/