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))))))
|
(slurp-non-text-data main-window iri :try-to-open nil))))))
|
||||||
|
|
||||||
(defun inline-image-p (link-value)
|
(defun inline-image-p (link-value)
|
||||||
(or (re:scan "(?i)jpg$" link-value)
|
(a:when-let* ((parsed (iri:iri-parse link-value :null-on-error t))
|
||||||
(re:scan "(?i)jpeg$" link-value)
|
(path (uri:path parsed)))
|
||||||
(re:scan "(?i)png$" link-value)
|
(and (or (gemini-client:absolute-gemini-url-p link-value)
|
||||||
(re:scan "(?i)gif$" link-value)
|
(not (iri:absolute-url-p link-value)))
|
||||||
(re:scan "(?i)bmp$" link-value)
|
(or (re:scan "(?i)jpg$" path)
|
||||||
(re:scan "(?i)tga$" link-value)))
|
(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)
|
(defun inline-possible-p (link-value)
|
||||||
(inline-image-p link-value))
|
(inline-image-p link-value))
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
(flet ((edit (file)
|
(flet ((edit (file)
|
||||||
(croatoan:end-screen)
|
(croatoan:end-screen)
|
||||||
(os-utils:open-with-editor file)))
|
(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)))
|
(parsed-no-fragment (iri:remove-fragment parsed-as-iri)))
|
||||||
(let ((program (if (iri:absolute-url-p resource)
|
(let ((program (if (iri:absolute-url-p resource)
|
||||||
(swconf:link-regex->program-to-use (text-utils:to-s parsed-no-fragment))
|
(swconf:link-regex->program-to-use (text-utils:to-s parsed-no-fragment))
|
||||||
|
|
|
@ -186,7 +186,7 @@
|
||||||
(flet ((edit (file)
|
(flet ((edit (file)
|
||||||
(croatoan:end-screen)
|
(croatoan:end-screen)
|
||||||
(os-utils:open-with-editor file)))
|
(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)))
|
(parsed-no-fragment (iri:remove-fragment parsed-as-iri)))
|
||||||
(let ((program (if (iri:absolute-url-p resource)
|
(let ((program (if (iri:absolute-url-p resource)
|
||||||
(swconf:link-regex->program-to-use (text-utils:to-s parsed-no-fragment))
|
(swconf:link-regex->program-to-use (text-utils:to-s parsed-no-fragment))
|
||||||
|
|
Loading…
Reference in New Issue