mirror of https://codeberg.org/cage/tinmop/
- [GUI] fixed scanning for images that can be inlined;
- prevented signaling an error when parsing an IRI to open the resource with an external program.
This commit is contained in:
parent
d8f389296e
commit
a5df3cbeae
|
@ -385,12 +385,16 @@
|
|||
(slurp-non-text-data main-window iri :try-to-open nil))))))
|
||||
|
||||
(defun inline-image-p (link-value)
|
||||
(or (re:scan "(?i)jpg$" link-value)
|
||||
(re:scan "(?i)jpeg$" link-value)
|
||||
(re:scan "(?i)png$" link-value)
|
||||
(re:scan "(?i)gif$" link-value)
|
||||
(re:scan "(?i)bmp$" link-value)
|
||||
(re:scan "(?i)tga$" link-value)))
|
||||
(a:when-let* ((parsed (iri:iri-parse link-value :null-on-error t))
|
||||
(path (uri:path parsed)))
|
||||
(and (or (gemini-client:absolute-gemini-url-p link-value)
|
||||
(not (iri:absolute-url-p link-value)))
|
||||
(or (re:scan "(?i)jpg$" path)
|
||||
(re:scan "(?i)jpeg$" path)
|
||||
(re:scan "(?i)png$" path)
|
||||
(re:scan "(?i)gif$" path)
|
||||
(re:scan "(?i)bmp$" path)
|
||||
(re:scan "(?i)tga$" path)))))
|
||||
|
||||
(defun inline-possible-p (link-value)
|
||||
(inline-image-p link-value))
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
(flet ((edit (file)
|
||||
(croatoan:end-screen)
|
||||
(os-utils:open-with-editor file)))
|
||||
(alexandria::when-let* ((parsed-as-iri (iri:iri-parse resource))
|
||||
(alexandria::when-let* ((parsed-as-iri (iri:iri-parse resource :null-on-error t))
|
||||
(parsed-no-fragment (iri:remove-fragment parsed-as-iri)))
|
||||
(let ((program (if (iri:absolute-url-p resource)
|
||||
(swconf:link-regex->program-to-use (text-utils:to-s parsed-no-fragment))
|
||||
|
|
|
@ -186,7 +186,7 @@
|
|||
(flet ((edit (file)
|
||||
(croatoan:end-screen)
|
||||
(os-utils:open-with-editor file)))
|
||||
(alexandria::when-let* ((parsed-as-iri (iri:iri-parse resource))
|
||||
(alexandria::when-let* ((parsed-as-iri (iri:iri-parse resource :null-on-error t))
|
||||
(parsed-no-fragment (iri:remove-fragment parsed-as-iri)))
|
||||
(let ((program (if (iri:absolute-url-p resource)
|
||||
(swconf:link-regex->program-to-use (text-utils:to-s parsed-no-fragment))
|
||||
|
|
Loading…
Reference in New Issue