(not failed)))
(defun shr-expand-url (url)
- (cond
- ;; Absolute URL.
- ((or (not url)
- (string-match "\\`[a-z]*:" url)
- (not shr-base))
- url)
- ((and (string-match "\\`//" url)
- (string-match "\\`[a-z]*:" shr-base))
- (concat (match-string 0 shr-base) url))
- ((and (not (string-match "/\\'" shr-base))
- (not (string-match "\\`/" url)))
- (concat shr-base "/" url))
- (t
- (concat shr-base url))))
+ (if (or (not url)
+ (string-match "\\`[a-z]*:" url)
+ (not shr-base))
+ ;; Absolute URL.
+ url
+ (let ((base shr-base))
+ (when (string-match "^\\([^?]+\\)[?]" base)
+ (setq base (match-string 1 base)))
+ (cond
+ ((and (string-match "\\`//" url)
+ (string-match "\\`[a-z]*:" base))
+ (concat (match-string 0 base) url))
+ ((and (not (string-match "/\\'" base))
+ (not (string-match "\\`/" url)))
+ (concat base "/" url))
+ (t
+ (concat base url))))))
(defun shr-ensure-newline ()
(unless (zerop (current-column))