From: Theodor Thornhill Date: Sat, 27 Feb 2021 10:19:35 +0000 (+0100) Subject: Protect against empty uris on windows X-Git-Tag: emacs-29.0.90~1616^2~524^2~4^2~160 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=fa3ab318fa0970b9590db92bf8230336fcbc61a7;p=emacs.git Protect against empty uris on windows Per https://github.com/joaotavora/eglot/issues/630. * eglot.el (eglot--uri-to-path): Check string length Co-authored-by: João Távora GitHub-reference: fix https://github.com/joaotavora/eglot/issues/610 --- diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 017b8200bfa..0cb5839f6d5 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/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.