]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix fileless eww form submission
authorBasil L. Contovounesios <contovob@tcd.ie>
Sat, 14 Sep 2019 14:55:24 +0000 (16:55 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Sat, 14 Sep 2019 14:55:24 +0000 (16:55 +0200)
* lisp/net/eww.el (eww-submit): Ignore file inputs with no
associated file name (bug#36520).

lisp/net/eww.el

index 2013604c9e7dc2b39016e46afbf6452e8fb8be5b..fb495a985824e70a0a380f18d8adb4037124d3a2 100644 (file)
@@ -1447,15 +1447,15 @@ See URL `https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input'.")
              (push (cons name (plist-get input :value))
                    values)))
           ((equal (plist-get input :type) "file")
-           (push (cons "file"
-                       (list (cons "filedata"
-                                   (with-temp-buffer
-                                     (insert-file-contents
-                                      (plist-get input :filename))
-                                     (buffer-string)))
-                             (cons "name" (plist-get input :name))
-                             (cons "filename" (plist-get input :filename))))
-                 values))
+            (when-let ((file (plist-get input :filename)))
+              (push (list "file"
+                          (cons "filedata"
+                                (with-temp-buffer
+                                  (insert-file-contents file)
+                                  (buffer-string)))
+                          (cons "name" name)
+                          (cons "filename" file))
+                    values)))
           ((equal (plist-get input :type) "submit")
            ;; We want the values from buttons if we hit a button if
            ;; we hit enter on it, or if it's the first button after