diff --git a/src/program-events.lisp b/src/program-events.lisp index a94159b..723821f 100644 --- a/src/program-events.lisp +++ b/src/program-events.lisp @@ -1018,6 +1018,8 @@ (when give-focus-to-message-window-p (ui:focus-to-message-window)) (cond + ((text-utils:string-empty-p url) + (ui:error-message (_ "Empty address"))) ((gemini-client:absolute-gemini-url-p url) (gemini-viewer:request url :use-cached-file-if-exists use-cached-file-if-exists)) ((fs:dirp local-path) diff --git a/src/text-utils.lisp b/src/text-utils.lisp index a531db4..87dccd6 100644 --- a/src/text-utils.lisp +++ b/src/text-utils.lisp @@ -695,19 +695,22 @@ printed in the box column by column; in the example above the results are: (percent-decode data))) (defun percent-encoded-p (string) - (loop for i in (coerce string 'list) - for ct from 0 do - (cond - ((char= i #\%) - (when (not (cl-ppcre:scan "(?i)^%[0123456789abcdef]{2}" string :start ct)) - (return-from percent-encoded-p nil))) - ((or (percent:reservedp i) - (char= i #\Space) - (not (or (percent:alphap (char-code i)) - (percent:digitp (char-code i)) - (percent:unreservedp (char-code i))))) - (return-from percent-encoded-p nil)))) - t) + (if (string-empty-p string) + nil + (progn + (loop for i in (coerce string 'list) + for ct from 0 do + (cond + ((char= i #\%) + (when (not (cl-ppcre:scan "(?i)^%[0123456789abcdef]{2}" string :start ct)) + (return-from percent-encoded-p nil))) + ((or (percent:reservedp i) + (char= i #\Space) + (not (or (percent:alphap (char-code i)) + (percent:digitp (char-code i)) + (percent:unreservedp (char-code i))))) + (return-from percent-encoded-p nil)))) + t))) (defun percent-encode-allow-null (data) (when data