branch: externals/eglot
commit 92b0c5d385cc6f3593f60c2f93917fd8b2d44207
Author: Theodor Thornhill <[email protected]>
Commit: GitHub <[email protected]>

    Fix #610: protect against empty URIs on windows
    
    Per #630.
    
    * eglot.el (eglot--uri-to-path): Check string length
    
    Co-authored-by: João Távora <[email protected]>
---
 eglot.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/eglot.el b/eglot.el
index 017b820..0cb5839 100644
--- a/eglot.el
+++ b/eglot.el
@@ -1176,7 +1176,8 @@ If optional MARKER, return a marker instead"
   "Convert URI to a file path."
   (when (keywordp uri) (setq uri (substring (symbol-name uri) 1)))
   (let ((retval (url-filename (url-generic-parse-url (url-unhex-string uri)))))
-    (if (eq system-type 'windows-nt) (substring retval 1) retval)))
+    (if (and (eq system-type 'windows-nt) (cl-plusp (length retval)))
+        (substring retval 1) retval)))
 
 (defun eglot--snippet-expansion-fn ()
   "Compute a function to expand snippets.

Reply via email to