1
0
mirror of https://codeberg.org/cage/tinmop/ synced 2024-12-18 23:22:52 +01:00

- prevented a crash when the user typed an invalid URL in the address bar.

This commit is contained in:
cage 2024-05-25 13:04:10 +02:00
parent 16d3595ea7
commit 6db875ad99

View File

@ -1033,41 +1033,44 @@ local file paths."
(render-line rendered-line))))))))))))
(defun open-iri (iri main-window use-cache &key (status +stream-status-streaming+))
(let ((actual-iri (remove-standard-port iri)))
(handler-case
(let ((parsed-iri (iri:iri-parse actual-iri)))
(cond
((string= (uri:scheme parsed-iri) +internal-scheme-view-source+)
(setf (uri:scheme parsed-iri) gemini-constants:+gemini-scheme+)
(start-stream-iri (iri-ensure-path (to-s parsed-iri))
(handler-case
(let* ((actual-iri (remove-standard-port iri))
(parsed-iri (iri:iri-parse actual-iri)))
(cond
((string= (uri:scheme parsed-iri) +internal-scheme-view-source+)
(setf (uri:scheme parsed-iri) gemini-constants:+gemini-scheme+)
(start-stream-iri (iri-ensure-path (to-s parsed-iri))
main-window
use-cache
:status status
:process-iri-lines-function (collect-source-lines-clsr main-window)))
((iri:iri= actual-iri (internal-iri-bookmark))
(initialize-ir-lines main-window)
(funcall (menu:show-bookmarks-clsr main-window)))
((iri:iri= actual-iri (internal-iri-gemlogs))
(menu:manage-gemlogs))
((gemini-client:absolute-titan-url-p actual-iri)
(client-titan-window:init-window main-window actual-iri))
((gemini-parser:gemini-iri-p actual-iri)
(let ((stream-frame (stream-frame main-window)))
(start-stream-iri (iri-ensure-path actual-iri)
main-window
use-cache
:status status
:process-iri-lines-function (collect-source-lines-clsr main-window)))
((iri:iri= actual-iri (internal-iri-bookmark))
(initialize-ir-lines main-window)
(funcall (menu:show-bookmarks-clsr main-window)))
((iri:iri= actual-iri (internal-iri-gemlogs))
(menu:manage-gemlogs))
((gemini-client:absolute-titan-url-p actual-iri)
(client-titan-window:init-window main-window actual-iri))
((gemini-parser:gemini-iri-p actual-iri)
(let ((stream-frame (stream-frame main-window)))
(start-stream-iri (iri-ensure-path actual-iri)
main-window
use-cache
:status status)
(client-stream-frame::refresh-all-streams
(client-stream-frame::table stream-frame))))
((or (null (uri:scheme parsed-iri))
(string= (uri:scheme parsed-iri)
constants:+file-scheme+))
(initialize-ir-lines main-window)
(open-local-path (uri:path parsed-iri) main-window))
(t
(client-os-utils:open-resource-with-external-program main-window actual-iri))))
(error (e)
(gui-goodies:notify-request-error e)))))
:status status)
(client-stream-frame::refresh-all-streams
(client-stream-frame::table stream-frame))))
((or (null (uri:scheme parsed-iri))
(string= (uri:scheme parsed-iri)
constants:+file-scheme+))
(initialize-ir-lines main-window)
(open-local-path (uri:path parsed-iri) main-window))
(t
(client-os-utils:open-resource-with-external-program main-window actual-iri))))
(esrap:esrap-parse-error (e)
(declare (ignore e))
(gui-goodies:notify-request-error (format nil (_ "Invalid address: ~s") iri)))
(error (e)
(gui-goodies:notify-request-error e))))
(defun get-user-request-query (iri meta main-window &key (sensitive nil))
(let* ((parsed-iri (iri:iri-parse iri))