branch: elpa/gptel
commit a6ac58f9603b70a8582dd7a8af974d0f5cc3b7ab
Author: kiennq <[email protected]>
Commit: GitHub <[email protected]>
gptel-request: Fix markdown link validation
gptel-request.el (gptel--markdown-validate-link): Handle file
links specified without "file://" correctly. (#1127)
Both [](file:///path/to/file) and [](/path/to/file) should be
validated, assuming the rest of the criteria are met. Previously
only the "file://" version worked.
---
gptel-request.el | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gptel-request.el b/gptel-request.el
index 0aa9ee4830f..dc193be7894 100644
--- a/gptel-request.el
+++ b/gptel-request.el
@@ -2240,7 +2240,7 @@ first nil value in REST is guaranteed to be correct."
(if-let* ((path (nth 3 link))
(prefix (or (string-search "://" path) 0))
(link-type (if (= prefix 0) "file" (substring path 0 prefix)))
- (path (if (equal link-type "file")
+ (path (if (and (equal link-type "file") (> prefix 0))
(substring path (+ prefix 3)) path))
(resource-type
(or (and (equal link-type "file") 'file)