GNU bug report logs -
#36520
Form submition in eww doesn't work if file field is left empty
Previous Next
Reported by: Ivaylo Ilionov <ivaylo.ilionov <at> outlook.com>
Date: Sat, 6 Jul 2019 11:29:01 UTC
Severity: normal
Tags: fixed, patch
Fixed in version 27.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #13 received at 36520 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Basil L. Contovounesios <contovob <at> tcd.ie> writes:
> I wonder if the file not being initialised is a symptom of a problem
elsewhere? An example might shed more light on this.
It's quite possible that my suggestion is a low quality patch or just
hides the real problem. I don't have a good undertanding of the
code for eww.
I've first encountered the problem in Redmine version 4.0.3.
The action which triggered the error was that for changing status
of an issue from "New" to "In Progress". The form contains
many things including the option to upload files for the issue
when changing statuses.
Here's a sample web form which demonstrates the problem:
<html> <body>
<form action="/non-existent.cgi" method="post">
Short comment: <input name='comment' type='text' /><br/>
Optional file: <input name='file' type='file' /><br/>
<input type='submit'/><br/>
<input type='reset'/>
</form>
</body> </html>
If a file hasn't been chosen the submition doesn't seem to work.
If a file is chosen i get a proper error from the server ("not found").
________________________________
From: Basil L. Contovounesios <contovob <at> tcd.ie>
Sent: Sunday, July 7, 2019 19:38
To: Ivaylo Ilionov
Cc: 36520 <at> debbugs.gnu.org
Subject: Re: bug#36520: Form submition in eww doesn't work if file field is left empty
tags 36520 + patch
quit
Ivaylo Ilionov <ivaylo.ilionov <at> outlook.com> writes:
> When submitting form with various fields including one optional
> field for file upload, if the file filed is left empty - the
> submition doesn't work.
>
> The error is: Wrong type argument: stringp, nil
Could you please give an example of such a form, for
reproduction/testing purposes?
> I've tracked the problem to the function 'eww-submit' which tries
> to open a file for upload (the file was never initialized by the
> html form).
I wonder if the file not being initialised is a symptom of a problem
elsewhere? An example might shed more light on this.
> My fix is to check if the property is set in the file "eww.el.gz" after
> line 1435:
>
>> ((equal (plist-get input :type) "file")
>> ;; FIX check if property :filename is not nil
>> (when (not (null (plist-get input :filename)))
FWIW, this is equivalent to (when (plist-get input :filename) ...).
>> (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)))
LGTM. Here's a patch which achieves the same effect and additionally
cleans up this code a tiny bit:
[Message part 2 (text/html, inline)]
This bug report was last modified 5 years and 245 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.