[Date Prev][Date Next][Thread Prev][][Date Index][Thread Index]

w3m-canonicalize-url misbehaviour



Hi,

Here is a patch for w3m-canonicalize-url. Without it, the following
code:

(let ((w3m-uri-replace-alist '(("\\     `ddg:" w3m-search-uri-replace "duckduckgo")))
      (w3m-search-engine-alist '(("duckduckgo" "https://duckduckgo.com/html/?q=%s"))))
  (w3m-canonicalize-url "ddg:foo"))

evaluates to "ddg:foo". So URI replacement is broken.
Index: w3m.el
===================================================================
RCS file: /storage/cvsroot/emacs-w3m/w3m.el,v
retrieving revision 1.1605
diff -u -p -r1.1605 w3m.el
--- w3m.el	2 Sep 2013 23:02:38 -0000	1.1605
+++ w3m.el	3 Sep 2013 12:47:39 -0000
@@ -4586,8 +4586,6 @@ Also fix URL that fails to have put a se
     (w3m-string-match-url-components url)
     (let (replaced)
       (cond
-       ((match-beginning 1)
-	url)
        ((and (file-name-absolute-p url) (file-exists-p url))
 	(concat "file://" url))
        ((and (setq replaced (ignore-errors (w3m-uri-replace url)))
@@ -4597,6 +4595,7 @@ Also fix URL that fails to have put a se
 	(concat "\
 http://www.google.com/search?btnI=I%%27m+Feeling+Lucky&ie=UTF-8&oe=UTF-8&q="
 		(w3m-url-encode-string url nil t)))
+       ((match-beginning 1) url)
        (t
 	(concat "http://" url))))))
 
-- 
Manuel Giraud