From 5e035458fe36e002294fc12ab0b25f2b815ee342 Mon Sep 17 00:00:00 2001 From: cage Date: Mon, 15 Nov 2021 18:17:21 +0100 Subject: [PATCH] - skipped redirect if parsing of iri failed. --- src/gemini-viewer.lisp | 4 ++-- src/gemini/client.lisp | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gemini-viewer.lisp b/src/gemini-viewer.lisp index f7b0e87..0451c23 100644 --- a/src/gemini-viewer.lisp +++ b/src/gemini-viewer.lisp @@ -641,8 +641,8 @@ (flet ((on-input-complete (maybe-accepted) (when (ui::boolean-input-accepted-p maybe-accepted) (pop-url-from-history specials:*message-window*) - (let ((new-url (gemini-client:build-redirect-iri meta - parsed-iri))) + (when-let ((new-url (gemini-client:build-redirect-iri meta + parsed-iri))) (db-utils:with-ready-database (:connect nil) (request new-url :enqueue enqueue diff --git a/src/gemini/client.lisp b/src/gemini/client.lisp index fffddc8..e5b46ba 100644 --- a/src/gemini/client.lisp +++ b/src/gemini/client.lisp @@ -541,7 +541,8 @@ TODO: Add client certificate." (labels ((redirect-dispatch (status code-description meta response socket iri parsed-iri) (declare (ignore status code-description response socket parsed-iri)) (when (< redirect-count +maximum-redirections+) - (slurp-gemini-url (build-redirect-iri meta iri) (1+ redirect-count)))) + (when-let ((iri-redirect (build-redirect-iri meta iri))) + (slurp-gemini-url iri-redirect (1+ redirect-count))))) (success-dispatch (status code-description meta response socket iri parsed-iri) (declare (ignorable code-description iri meta parsed-iri)) (debug-gemini "success response data: ~s ~s ~s ~s ~s ~s"