GNU logs - #36520, boring messages


Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#36520: Form submition in eww doesn't work if file field is left empty
Resent-From: Ivaylo Ilionov <ivaylo.ilionov@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sat, 06 Jul 2019 11:29:01 +0000
Resent-Message-ID: <handler.36520.B.156241250730594 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 36520
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: 36520 <at> debbugs.gnu.org
X-Debbugs-Original-To: "bug-gnu-emacs@HIDDEN" <bug-gnu-emacs@HIDDEN>
Received: via spool by submit <at> debbugs.gnu.org id=B.156241250730594
          (code B ref -1); Sat, 06 Jul 2019 11:29:01 +0000
Received: (at submit) by debbugs.gnu.org; 6 Jul 2019 11:28:27 +0000
Received: from localhost ([127.0.0.1]:54250 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hjirh-0007xN-Qx
	for submit <at> debbugs.gnu.org; Sat, 06 Jul 2019 07:28:27 -0400
Received: from lists.gnu.org ([209.51.188.17]:58705)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ivaylo.ilionov@HIDDEN>) id 1hji6h-0006oh-3r
 for submit <at> debbugs.gnu.org; Sat, 06 Jul 2019 06:39:52 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:43839)
 by lists.gnu.org with esmtp (Exim 4.86_2)
 (envelope-from <ivaylo.ilionov@HIDDEN>) id 1hji6f-00053k-RD
 for bug-gnu-emacs@HIDDEN; Sat, 06 Jul 2019 06:39:50 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: ***
X-Spam-Status: No, score=3.3 required=5.0 tests=BAYES_50,FREEMAIL_FROM,
 HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RECEIVED_FROM_WINDOWS_HOST,URIBL_BLOCKED
 autolearn=disabled version=3.3.2
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <ivaylo.ilionov@HIDDEN>) id 1hji6e-0002R8-K4
 for bug-gnu-emacs@HIDDEN; Sat, 06 Jul 2019 06:39:49 -0400
Received: from mail-oln040092067017.outbound.protection.outlook.com
 ([40.92.67.17]:59777 helo=EUR02-AM5-obe.outbound.protection.outlook.com)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <ivaylo.ilionov@HIDDEN>)
 id 1hji6e-0002Jj-5D
 for bug-gnu-emacs@HIDDEN; Sat, 06 Jul 2019 06:39:48 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com;
 s=selector1;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=+c3xbZbpcHtQvm++mESCyrTuZo1h7yyGO6LMv73bWFE=;
 b=JSm55CYWBaO1muMgL1x9LNN1QW4MbH+K2VzohfighEsJREDr69m3vP+0AMZkM8XOTctNpXAim/ux3xRw3qEdK3qjJgQXH9yVmreBLuTqoTpaxljXZRyuSYdhO3/e7EtGpxN67oLdk5mFFGhMPywj7yS8CghfoESXj+HGI0Pv0dNLjXCJcTILwo6c8xEpZ8Q1NnG7M6EuipztVlHK0ZP5Jryp66DztLFpvh0uYlybOcqevNJWCBKCIm6rRLxdazgFk8K6Si0XwgBjtt/azReBeLaJ/dOp29M1r5R1TQS/GF3iUae2vVXYDqs5Hit34G6FR6XDV7YCTSxHm9ypQ+gAPQ==
Received: from AM5EUR02FT025.eop-EUR02.prod.protection.outlook.com
 (10.152.8.57) by AM5EUR02HT078.eop-EUR02.prod.protection.outlook.com
 (10.152.9.38) with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2052.19; Sat, 6 Jul
 2019 10:39:41 +0000
Received: from VE1PR08MB5136.eurprd08.prod.outlook.com (10.152.8.60) by
 AM5EUR02FT025.mail.protection.outlook.com (10.152.8.110) with Microsoft SMTP
 Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id
 15.20.2052.19 via Frontend Transport; Sat, 6 Jul 2019 10:39:41 +0000
Received: from VE1PR08MB5136.eurprd08.prod.outlook.com
 ([fe80::50ad:8d7e:8ed7:70bc]) by VE1PR08MB5136.eurprd08.prod.outlook.com
 ([fe80::50ad:8d7e:8ed7:70bc%3]) with mapi id 15.20.2032.019; Sat, 6 Jul 2019
 10:39:41 +0000
From: Ivaylo Ilionov <ivaylo.ilionov@HIDDEN>
Thread-Topic: Form submition in eww doesn't work if file field is left empty
Thread-Index: AQHVM+aIxyTPJwinFUyAHbLPc99LtA==
Date: Sat, 6 Jul 2019 10:39:41 +0000
Message-ID: <VE1PR08MB513653BD4614A51CADF8E27C82F40@HIDDEN>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-incomingtopheadermarker: OriginalChecksum:3959AAC6DFC8A9FB0851B20B1868E5EA36A3CF66858349AD189F3804620CA2B0;
 UpperCasedChecksum:288BFD68D88B5C5C9FA16FB4FD90B4DA0B81AC5F61F8E30D5A2E0854D9D473DB;
 SizeAsReceived:6577; Count:40
x-tmn: [ItoUGwZpPZmbCUt2jKKyGt96jkSbcR4r]
x-ms-publictraffictype: Email
x-incomingheadercount: 40
x-eopattributedmessage: 0
x-microsoft-antispam: BCL:0; PCL:0;
 RULEID:(2390118)(5050001)(7020095)(20181119110)(201702061078)(5061506573)(5061507331)(1603103135)(2017031320274)(2017031322404)(2017031323274)(2017031324274)(1601125500)(1603101475)(1701031045);
 SRVR:AM5EUR02HT078; 
x-ms-traffictypediagnostic: AM5EUR02HT078:
x-microsoft-antispam-message-info: Qc40dfoiPYvfqS2lsGkRkzlIDI2GQPsAG8eqwh1iwpXXkhGA0tJx2pTAXjjZQBsP6dBCva9Bi8FYAX2HqNBQULBRyxVgkg0btgdnKp/3CyK3TW7dfJGI4ZGoasMXsLJjYP8SON7SlvzFJTjS+3Qm+X//gv7HQtfC1FvT1/atjYqmIgFdRFEauvmH/SMGLmwu
Content-Type: multipart/alternative;
 boundary="_000_VE1PR08MB513653BD4614A51CADF8E27C82F40VE1PR08MB5136eurp_"
MIME-Version: 1.0
X-OriginatorOrg: outlook.com
X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000
X-MS-Exchange-CrossTenant-Network-Message-Id: 4c2a7871-e4a7-469d-5b55-08d701fe40e6
X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000
X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Jul 2019 10:39:41.7704 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Internet
X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa
X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5EUR02HT078
X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy]
X-Received-From: 40.92.67.17
X-Spam-Score: -1.3 (-)
X-Mailman-Approved-At: Sat, 06 Jul 2019 07:28:24 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

--_000_VE1PR08MB513653BD4614A51CADF8E27C82F40VE1PR08MB5136eurp_
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

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

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).

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)))
>    (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)))

Details about my emacs:

In GNU Emacs 27.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 2.24.32)
 of 2019-07-05 built on debian
Repository revision: f24d47359d9b6621215f20795d585c5024d91783
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12004000
System Description: Debian GNU/Linux 10 (buster)


--_000_VE1PR08MB513653BD4614A51CADF8E27C82F40VE1PR08MB5136eurp_
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<html>
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Diso-8859-=
1">
<style type=3D"text/css" style=3D"display:none;"> P {margin-top:0;margin-bo=
ttom:0;} </style>
</head>
<body dir=3D"ltr">
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);">
When submitting form with various fields including one optional<br>
<div>field for file upload, if the file filed is left empty - the<br>
</div>
<div>submition doesn't work.<br>
</div>
<div><br>
</div>
<div>The error is: Wrong type argument: stringp, nil<br>
</div>
<div><br>
</div>
<div>I've tracked the problem to the function 'eww-submit' which tries<br>
</div>
<div>to open a file for upload (the file was never initialized by the<br>
</div>
<div>html form).<br>
</div>
<div><br>
</div>
<div>My fix is to check if the property is set in the file &quot;eww.el.gz&=
quot; after<br>
</div>
<div>line 1435:<br>
</div>
<div><br>
</div>
<div>&gt; ((equal (plist-get input :type) &quot;file&quot;)<br>
</div>
<div>&gt; &nbsp;;; FIX check if property :filename is not nil<br>
</div>
<div>&gt; &nbsp;(when (not (null (plist-get input :filename)))<br>
</div>
<div>&gt; &nbsp; &nbsp;(push (cons &quot;file&quot;<br>
</div>
<div>&gt; &nbsp; &nbsp; &nbsp; &nbsp; (list (cons &quot;filedata&quot;<br>
</div>
<div>&gt; &nbsp; &nbsp; &nbsp; (with-temp-buffer<br>
</div>
<div>&gt; &nbsp; &nbsp; &nbsp; &nbsp; (insert-file-contents<br>
</div>
<div>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(plist-get input :filename))<br=
>
</div>
<div>&gt; &nbsp; &nbsp; &nbsp; &nbsp; (buffer-string)))<br>
</div>
<div>&gt; &nbsp; &nbsp; &nbsp; &nbsp;(cons &quot;name&quot; (plist-get inpu=
t :name))<br>
</div>
<div>&gt; &nbsp; &nbsp; &nbsp; &nbsp;(cons &quot;filename&quot; (plist-get =
input :filename))))<br>
</div>
<div>&gt; &nbsp; values)))<br>
</div>
<div><br>
</div>
<div>Details about my emacs:<br>
</div>
<div><br>
</div>
<div>In GNU Emacs 27.0.50 (build 1, x86_64-pc-linux-gnu, GTK&#43; Version 2=
.24.32)<br>
</div>
<div>&nbsp;of 2019-07-05 built on debian<br>
</div>
<div>Repository revision: f24d47359d9b6621215f20795d585c5024d91783<br>
</div>
<div>Repository branch: master<br>
</div>
<div>Windowing system distributor 'The X.Org Foundation', version 11.0.1200=
4000<br>
</div>
<div>System Description: Debian GNU/Linux 10 (buster)<br>
</div>
<span></span><br>
</div>
</body>
</html>

--_000_VE1PR08MB513653BD4614A51CADF8E27C82F40VE1PR08MB5136eurp_--




Message sent:


Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-Mailer: MIME-tools 5.505 (Entity 5.505)
Content-Type: text/plain; charset=utf-8
X-Loop: help-debbugs@HIDDEN
From: help-debbugs@HIDDEN (GNU bug Tracking System)
To: Ivaylo Ilionov <ivaylo.ilionov@HIDDEN>
Subject: bug#36520: Acknowledgement (Form submition in eww doesn't work if
 file field is left empty)
Message-ID: <handler.36520.B.156241250730594.ack <at> debbugs.gnu.org>
References: <VE1PR08MB513653BD4614A51CADF8E27C82F40@HIDDEN>
X-Gnu-PR-Message: ack 36520
X-Gnu-PR-Package: emacs
Reply-To: 36520 <at> debbugs.gnu.org
Date: Sat, 06 Jul 2019 11:29:02 +0000

Thank you for filing a new bug report with debbugs.gnu.org.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):
 bug-gnu-emacs@HIDDEN

If you wish to submit further information on this problem, please
send it to 36520 <at> debbugs.gnu.org.

Please do not send mail to help-debbugs@HIDDEN unless you wish
to report a problem with the Bug-tracking system.

--=20
36520: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D36520
GNU Bug Tracking System
Contact help-debbugs@HIDDEN with problems


Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#36520: Form submition in eww doesn't work if file field is left empty
Resent-From: "Basil L. Contovounesios" <contovob@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sun, 07 Jul 2019 16:39:02 +0000
Resent-Message-ID: <handler.36520.B36520.156251751920457 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 36520
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Ivaylo Ilionov <ivaylo.ilionov@HIDDEN>
Cc: 36520 <at> debbugs.gnu.org
Received: via spool by 36520-submit <at> debbugs.gnu.org id=B36520.156251751920457
          (code B ref 36520); Sun, 07 Jul 2019 16:39:02 +0000
Received: (at 36520) by debbugs.gnu.org; 7 Jul 2019 16:38:39 +0000
Received: from localhost ([127.0.0.1]:57350 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hkABT-0005Jo-Gs
	for submit <at> debbugs.gnu.org; Sun, 07 Jul 2019 12:38:39 -0400
Received: from mail-ed1-f68.google.com ([209.85.208.68]:33642)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <contovob@HIDDEN>) id 1hkABQ-0005JP-Ol
 for 36520 <at> debbugs.gnu.org; Sun, 07 Jul 2019 12:38:38 -0400
Received: by mail-ed1-f68.google.com with SMTP id i11so12399736edq.0
 for <36520 <at> debbugs.gnu.org>; Sun, 07 Jul 2019 09:38:36 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=tcd-ie.20150623.gappssmtp.com; s=20150623;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version;
 bh=5zdM2pQ3A7Y44TwVonC/ecBbg2q80rkPV+XVH+odyl4=;
 b=ZHeywVpRnt1PP62hRwB2YWgoFjJuBY3BOncyQSrexmIfttI4uj+o4zTIH2hOzOnQ8B
 a2g95qNlOxe4mU3xXgTEZNuwZOc6QIx83KpL1cnU2VIp2n0qi+LFUeJC86kS4RHnKy3h
 4Bm3jcvhM4TKG8bJNsEScD9J7auZEH8WJNXqjHjaQS/mvIaVSjeWr6/0I+nGkEQqm6wD
 2cEa2sNun7a8YTy95UcetBeku72HR/mESKxf3OoZ3bOMiyHxd3jzF9WS9Wc2teaRhD1Y
 cEfn8ZL0AQU5XdNNM4D6Hs/tFV51AaxUNaGN7tagyQUxqn2C4K+EjzOTAI7fdLam9chU
 zfdA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version;
 bh=5zdM2pQ3A7Y44TwVonC/ecBbg2q80rkPV+XVH+odyl4=;
 b=k58uc1VjAE6U1G+6b/rr52mHKhfXCNarQW8+PhEIjhCH8ec2MSCnCWcUgbxjsO2PlG
 w9ZbIqbyQc8sfceWSCxni6udsozsgsb3it3XVQOFaMXhQydnhprE4Od3TL6R4E6ceegn
 qvH92T2bubEInlFmnG0guiRRFlXoAKiyb03G+ruqQOaUTeqM6F5lnxtP/F2AmwwFmluI
 WcvP5h4EyBhZ2yZ0bjs1IYyNjQqFONzc0maflI34sRhjidoWakIoQhGIiEVQgw+G/cOT
 PCII6BcciGXHmi2SgYb/m2PF1Qnf1TijYP0xMfa8i+5L4XpV+IqATYrABjnewTcr0SSc
 JWBA==
X-Gm-Message-State: APjAAAXIbEvUMVagO+/BbeSiCSuxLfZnlkviWh+FXV2KC8I9OwEv3606
 6ylqE8jDkUSRA5/tcTDJUn8w0Q==
X-Google-Smtp-Source: APXvYqw68tpAsQR3Rrj2zFPpaVobeLuQNOgcQ/0MYcYjtFVDv4Zl2y+kSGyCipYrPvCgRElQiKsIyg==
X-Received: by 2002:aa7:d909:: with SMTP id a9mr15682034edr.261.1562517510739; 
 Sun, 07 Jul 2019 09:38:30 -0700 (PDT)
Received: from localhost ([2a02:8084:20e2:c380:92bd:1bfd:38fc:fae2])
 by smtp.gmail.com with ESMTPSA id d4sm4690253edb.4.2019.07.07.09.38.29
 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256);
 Sun, 07 Jul 2019 09:38:29 -0700 (PDT)
From: "Basil L. Contovounesios" <contovob@HIDDEN>
References: <VE1PR08MB513653BD4614A51CADF8E27C82F40@HIDDEN>
Date: Sun, 07 Jul 2019 17:38:24 +0100
In-Reply-To: <VE1PR08MB513653BD4614A51CADF8E27C82F40@HIDDEN>
 (Ivaylo Ilionov's message of "Sat, 6 Jul 2019 10:39:41 +0000")
Message-ID: <87d0iler5r.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: 1.3 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview: tags 36520 + patch quit Ivaylo Ilionov
 <ivaylo.ilionov@HIDDEN>
 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: string [...] 
 Content analysis details:   (1.3 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 0.0 URIBL_BLOCKED          ADMINISTRATOR NOTICE: The query to URIBL was
 blocked.  See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block
 for more information. [URIs: outlook.com]
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
 no trust [209.85.208.68 listed in list.dnswl.org]
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 0.0 SPF_NONE               SPF: sender does not publish an SPF Record
 1.3 PDS_NO_HELO_DNS        High profile HELO but no A record
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.3 (/)

--=-=-=
Content-Type: text/plain

tags 36520 + patch
quit

Ivaylo Ilionov <ivaylo.ilionov@HIDDEN> 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:


--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline;
 filename=0001-Fix-fileless-eww-form-submission.patch

From 6c4fdcf2434391236d9ac1a891ba751e82831e37 Mon Sep 17 00:00:00 2001
From: "Basil L. Contovounesios" <contovob@HIDDEN>
Date: Sun, 7 Jul 2019 15:36:36 +0100
Subject: [PATCH] Fix fileless eww form submission

* lisp/net/eww.el (eww-submit): Ignore file inputs with no
associated file name (bug#36520).
---
 lisp/net/eww.el | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 1125929c03..5acc645574 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -1426,15 +1426,15 @@ eww-submit
 	      (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
-- 
2.20.1


--=-=-=
Content-Type: text/plain


This is probably fine to push as-is, as it's just a defensive guard, but
I'd rather get confirmation from someone else or play around with an
example of the bug first.

Thanks,

-- 
Basil

--=-=-=--




Message received at control <at> debbugs.gnu.org:


Received: (at control) by debbugs.gnu.org; 7 Jul 2019 16:38:39 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jul 07 12:38:39 2019
Received: from localhost ([127.0.0.1]:57348 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hkABT-0005Jl-5k
	for submit <at> debbugs.gnu.org; Sun, 07 Jul 2019 12:38:39 -0400
Received: from mail-ed1-f65.google.com ([209.85.208.65]:43001)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <contovob@HIDDEN>) id 1hkABQ-0005JQ-QD
 for control <at> debbugs.gnu.org; Sun, 07 Jul 2019 12:38:37 -0400
Received: by mail-ed1-f65.google.com with SMTP id v15so5740343eds.9
 for <control <at> debbugs.gnu.org>; Sun, 07 Jul 2019 09:38:36 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=tcd-ie.20150623.gappssmtp.com; s=20150623;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version;
 bh=5zdM2pQ3A7Y44TwVonC/ecBbg2q80rkPV+XVH+odyl4=;
 b=ZHeywVpRnt1PP62hRwB2YWgoFjJuBY3BOncyQSrexmIfttI4uj+o4zTIH2hOzOnQ8B
 a2g95qNlOxe4mU3xXgTEZNuwZOc6QIx83KpL1cnU2VIp2n0qi+LFUeJC86kS4RHnKy3h
 4Bm3jcvhM4TKG8bJNsEScD9J7auZEH8WJNXqjHjaQS/mvIaVSjeWr6/0I+nGkEQqm6wD
 2cEa2sNun7a8YTy95UcetBeku72HR/mESKxf3OoZ3bOMiyHxd3jzF9WS9Wc2teaRhD1Y
 cEfn8ZL0AQU5XdNNM4D6Hs/tFV51AaxUNaGN7tagyQUxqn2C4K+EjzOTAI7fdLam9chU
 zfdA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version;
 bh=5zdM2pQ3A7Y44TwVonC/ecBbg2q80rkPV+XVH+odyl4=;
 b=ZCCQWCeG3PMw0lpEU8MHo6ug1SBRzMG09CG8RJGIvjqcLxu3Z6WuopiwDltED9EWRm
 PsFrQ+5ReK2+LSf0Uyo4VDOgrbz2KQ4mx466ZWIgTCUse9Sv7BFtLoFxo2aDBuxOSOXG
 XfudVrH5SHPgvOOIU3l+cekiQ0zc17XU17SlsR04iXZyc9+ijw1JKHRcOwqJ3u3nB1u3
 xxbCjtGDk24wJ4qiMpusKlOtv2xCerAwBESAACCUrvzyproIQ/qSXnwkFvVWAFjLzg4+
 HEh3P0YjDzH2G8yJq0YIj6nUg7o4/DqsZ+cqFzXFq0rmkMweOdycq9/uWALGpqJO9YEn
 NHHA==
X-Gm-Message-State: APjAAAVjIWwsx1zhoHPsVjuUiU47mqrhtHRrqAAXi6gbA0AhB6PkYc/C
 1UdHA6xuILQ31jnPwCtZtGNqSQ==
X-Google-Smtp-Source: APXvYqw68tpAsQR3Rrj2zFPpaVobeLuQNOgcQ/0MYcYjtFVDv4Zl2y+kSGyCipYrPvCgRElQiKsIyg==
X-Received: by 2002:aa7:d909:: with SMTP id a9mr15682034edr.261.1562517510739; 
 Sun, 07 Jul 2019 09:38:30 -0700 (PDT)
Received: from localhost ([2a02:8084:20e2:c380:92bd:1bfd:38fc:fae2])
 by smtp.gmail.com with ESMTPSA id d4sm4690253edb.4.2019.07.07.09.38.29
 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256);
 Sun, 07 Jul 2019 09:38:29 -0700 (PDT)
From: "Basil L. Contovounesios" <contovob@HIDDEN>
To: Ivaylo Ilionov <ivaylo.ilionov@HIDDEN>
Subject: Re: bug#36520: Form submition in eww doesn't work if file field is
 left empty
References: <VE1PR08MB513653BD4614A51CADF8E27C82F40@HIDDEN>
Date: Sun, 07 Jul 2019 17:38:24 +0100
In-Reply-To: <VE1PR08MB513653BD4614A51CADF8E27C82F40@HIDDEN>
 (Ivaylo Ilionov's message of "Sat, 6 Jul 2019 10:39:41 +0000")
Message-ID: <87d0iler5r.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: 1.3 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview: tags 36520 + patch quit Ivaylo Ilionov
 <ivaylo.ilionov@HIDDEN>
 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: string [...] 
 Content analysis details:   (1.3 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 0.0 SPF_NONE               SPF: sender does not publish an SPF Record
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
 no trust [209.85.208.65 listed in list.dnswl.org]
 0.0 URIBL_BLOCKED          ADMINISTRATOR NOTICE: The query to URIBL was
 blocked.  See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block
 for more information. [URIs: outlook.com]
 -0.0 RCVD_IN_MSPIKE_H2      RBL: Average reputation (+2)
 [209.85.208.65 listed in wl.mailspike.net]
 1.3 PDS_NO_HELO_DNS        High profile HELO but no A record
X-Debbugs-Envelope-To: control
Cc: 36520 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.3 (/)

--=-=-=
Content-Type: text/plain

tags 36520 + patch
quit

Ivaylo Ilionov <ivaylo.ilionov@HIDDEN> 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:


--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline;
 filename=0001-Fix-fileless-eww-form-submission.patch

From 6c4fdcf2434391236d9ac1a891ba751e82831e37 Mon Sep 17 00:00:00 2001
From: "Basil L. Contovounesios" <contovob@HIDDEN>
Date: Sun, 7 Jul 2019 15:36:36 +0100
Subject: [PATCH] Fix fileless eww form submission

* lisp/net/eww.el (eww-submit): Ignore file inputs with no
associated file name (bug#36520).
---
 lisp/net/eww.el | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 1125929c03..5acc645574 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -1426,15 +1426,15 @@ eww-submit
 	      (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
-- 
2.20.1


--=-=-=
Content-Type: text/plain


This is probably fine to push as-is, as it's just a defensive guard, but
I'd rather get confirmation from someone else or play around with an
example of the bug first.

Thanks,

-- 
Basil

--=-=-=--




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#36520: Form submition in eww doesn't work if file field is left empty
Resent-From: Ivaylo Ilionov <ivaylo.ilionov@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sun, 07 Jul 2019 21:17:01 +0000
Resent-Message-ID: <handler.36520.B36520.156253418731652 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 36520
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: "Basil L. Contovounesios" <contovob@HIDDEN>
Cc: "36520 <at> debbugs.gnu.org" <36520 <at> debbugs.gnu.org>
Received: via spool by 36520-submit <at> debbugs.gnu.org id=B36520.156253418731652
          (code B ref 36520); Sun, 07 Jul 2019 21:17:01 +0000
Received: (at 36520) by debbugs.gnu.org; 7 Jul 2019 21:16:27 +0000
Received: from localhost ([127.0.0.1]:57488 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hkEWH-0008EQ-Mw
	for submit <at> debbugs.gnu.org; Sun, 07 Jul 2019 17:16:27 -0400
Received: from mail-oln040092070019.outbound.protection.outlook.com
 ([40.92.70.19]:5063 helo=EUR03-AM5-obe.outbound.protection.outlook.com)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ivaylo.ilionov@HIDDEN>) id 1hkEDm-0007i3-H4
 for 36520 <at> debbugs.gnu.org; Sun, 07 Jul 2019 16:57:20 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com;
 s=selector1;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=9tx6utHy/wcMWCguMhPWk7oMFpkQ0EJ1Dv2ETnnK+QY=;
 b=tvVZAgvtuvmKzl4EWzkZ9zpfq7jjnA+AOqo2kFArhRjO5CTyZsbgQOCm+QMb6lvyAzxx9666Fiepvqo7D/mb4siw8Xklv5EqT3V9ykhEsHkt446KM9Po0WPFuh+ZkLSIoKWGDKuRZWaqC5Tc8AO9mjLxmbhktRgGos4toIqd6I45cDCAE1K1wyvxPTiD3poK2TykyQFlgjRSBb1oh7sfpsjHXYsl6eUj6P/xJa24ued4WdjHKhN5NuQebovqL+0lRZOapjeOTkCs6CL4ZQkSJ57GH9bN8r/6pS+hF5GJ+Bk3F41wlZ8ucK+fk7XlrhN04tcbgU2maaFfQmSelSsKgA==
Received: from VE1EUR03FT036.eop-EUR03.prod.protection.outlook.com
 (10.152.18.57) by VE1EUR03HT054.eop-EUR03.prod.protection.outlook.com
 (10.152.19.205) with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2052.18; Sun, 7 Jul
 2019 20:57:11 +0000
Received: from VE1PR08MB5136.eurprd08.prod.outlook.com (10.152.18.59) by
 VE1EUR03FT036.mail.protection.outlook.com (10.152.19.204) with Microsoft SMTP
 Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.20.2052.18 via Frontend Transport; Sun, 7 Jul 2019 20:57:11 +0000
Received: from VE1PR08MB5136.eurprd08.prod.outlook.com
 ([fe80::e85f:3673:be4f:f4ee]) by VE1PR08MB5136.eurprd08.prod.outlook.com
 ([fe80::e85f:3673:be4f:f4ee%5]) with mapi id 15.20.2052.020; Sun, 7 Jul 2019
 20:57:11 +0000
From: Ivaylo Ilionov <ivaylo.ilionov@HIDDEN>
Thread-Topic: bug#36520: Form submition in eww doesn't work if file field is
 left empty
Thread-Index: AQHVM+aIxyTPJwinFUyAHbLPc99LtKa/XQe2gABE+jw=
Date: Sun, 7 Jul 2019 20:57:11 +0000
Message-ID: <VE1PR08MB5136AAF0D6D0F395E997E85F82F70@HIDDEN>
References: <VE1PR08MB513653BD4614A51CADF8E27C82F40@HIDDEN>,
 <87d0iler5r.fsf@HIDDEN>
In-Reply-To: <87d0iler5r.fsf@HIDDEN>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-incomingtopheadermarker: OriginalChecksum:EB5BA9B8F64DDED3B644E726482DE04712BF8414612FBB53B937B6DAA83CAD6B;
 UpperCasedChecksum:F7F8EE65443CF3BD6E02E1FD37F2109CD356CA08FA3180D27A3FD6FEAA74FBB4;
 SizeAsReceived:6827; Count:43
x-tmn: [INiccTHG1wO8HR/xhn+8n3UkW8+Ksuqe]
x-ms-publictraffictype: Email
x-incomingheadercount: 43
x-eopattributedmessage: 0
x-microsoft-antispam: BCL:0; PCL:0;
 RULEID:(2390118)(5050001)(7020095)(20181119110)(201702061078)(5061506573)(5061507331)(1603103135)(2017031320274)(2017031323274)(2017031324274)(2017031322404)(1601125500)(1603101475)(1701031045);
 SRVR:VE1EUR03HT054; 
x-ms-traffictypediagnostic: VE1EUR03HT054:
x-microsoft-antispam-message-info: yW5xJSt1Bl8yN6jX/pFx1qozsO5Ec5astENQoXNfZmQ9FnufkVYDEN2u9lSSUHVdwbQm8QSh4Hwdk6SMdJHDZfc+xK5tV5UrDBe/hW9l0DFaOMg1rMcqMtT6vboN/EIlfnL24NhDkaNJ1rT3wX59gkOWg3whz6bK78a4tEzgqhO2sJB6i3SA1Zp7KZpDcl4h
Content-Type: multipart/alternative;
 boundary="_000_VE1PR08MB5136AAF0D6D0F395E997E85F82F70VE1PR08MB5136eurp_"
MIME-Version: 1.0
X-OriginatorOrg: outlook.com
X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000
X-MS-Exchange-CrossTenant-Network-Message-Id: 7eb51138-13b3-43c3-f0d7-08d7031dae74
X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000
X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Jul 2019 20:57:11.1139 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Internet
X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa
X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1EUR03HT054
X-Spam-Score: 0.0 (/)
X-Mailman-Approved-At: Sun, 07 Jul 2019 17:16:24 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--_000_VE1PR08MB5136AAF0D6D0F395E997E85F82F70VE1PR08MB5136eurp_
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Basil L. Contovounesios <contovob@HIDDEN> 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=3D"/non-existent.cgi" method=3D"post">
      Short comment: <input name=3D'comment' type=3D'text' /><br/>
      Optional file: <input name=3D'file' type=3D'file' /><br/>
      <input type=3D'submit'/><br/>
      <input type=3D'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@HIDDEN>
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@HIDDEN> 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:


--_000_VE1PR08MB5136AAF0D6D0F395E997E85F82F70VE1PR08MB5136eurp_
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<html>
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Diso-8859-=
1">
<style type=3D"text/css" style=3D"display:none;"> P {margin-top:0;margin-bo=
ttom:0;} </style>
</head>
<body dir=3D"ltr">
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);">
<font style=3D"font-size:11pt" face=3D"Calibri, sans-serif" color=3D"#00000=
0">Basil L. Contovounesios &lt;contovob@HIDDEN&gt;</font> writes:<br>
</div>
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);">
&gt; <font size=3D"2"><span style=3D"font-size:11pt">I wonder if the file n=
ot being initialised is a symptom of a problem<br>
elsewhere?&nbsp; An example might shed more light on this.</span></font><br=
>
</div>
<div>
<div id=3D"appendonsend"></div>
<div style=3D"font-family:Calibri,Helvetica,sans-serif; font-size:12pt; col=
or:rgb(0,0,0)">
<br>
</div>
<div style=3D"font-family:Calibri,Helvetica,sans-serif; font-size:12pt; col=
or:rgb(0,0,0)">
It's quite possible that my suggestion is a low quality patch or just</div>
<div style=3D"font-family:Calibri,Helvetica,sans-serif; font-size:12pt; col=
or:rgb(0,0,0)">
hides the real problem. I don't have a good undertanding of the</div>
<div style=3D"font-family:Calibri,Helvetica,sans-serif; font-size:12pt; col=
or:rgb(0,0,0)">
code for eww. <br>
</div>
<div style=3D"font-family:Calibri,Helvetica,sans-serif; font-size:12pt; col=
or:rgb(0,0,0)">
<br>
</div>
<div style=3D"font-family:Calibri,Helvetica,sans-serif; font-size:12pt; col=
or:rgb(0,0,0)">
I've first encountered the problem in Redmine version 4.0.3.</div>
<div style=3D"font-family:Calibri,Helvetica,sans-serif; font-size:12pt; col=
or:rgb(0,0,0)">
The action which triggered the error was that for changing status</div>
<div style=3D"font-family:Calibri,Helvetica,sans-serif; font-size:12pt; col=
or:rgb(0,0,0)">
of an issue from &quot;New&quot; to &quot;In Progress&quot;. The form conta=
ins</div>
<div style=3D"font-family:Calibri,Helvetica,sans-serif; font-size:12pt; col=
or:rgb(0,0,0)">
many things including the option to upload files for the issue</div>
<div style=3D"font-family:Calibri,Helvetica,sans-serif; font-size:12pt; col=
or:rgb(0,0,0)">
when changing statuses.<br>
</div>
<div style=3D"font-family:Calibri,Helvetica,sans-serif; font-size:12pt; col=
or:rgb(0,0,0)">
<br>
</div>
<div style=3D"font-family:Calibri,Helvetica,sans-serif; font-size:12pt; col=
or:rgb(0,0,0)">
Here's a sample web form which demonstrates the problem:</div>
<div style=3D"font-family:Calibri,Helvetica,sans-serif; font-size:12pt; col=
or:rgb(0,0,0)">
<span><br>
</span></div>
<div style=3D"font-family:Calibri,Helvetica,sans-serif; font-size:12pt; col=
or:rgb(0,0,0)">
<span>&lt;html&gt; &lt;body&gt;<br>
</span>
<div>&nbsp; &nbsp; &lt;form action=3D&quot;/non-existent.cgi&quot; method=
=3D&quot;post&quot;&gt;<br>
</div>
<div>&nbsp; &nbsp; &nbsp; Short comment: &lt;input name=3D'comment' type=3D=
'text' /&gt;&lt;br/&gt;<br>
</div>
<div>&nbsp; &nbsp; &nbsp; Optional file: &lt;input name=3D'file' type=3D'fi=
le' /&gt;&lt;br/&gt;<br>
</div>
<div>&nbsp; &nbsp; &nbsp; &lt;input type=3D'submit'/&gt;&lt;br/&gt;<br>
</div>
<div>&nbsp; &nbsp; &nbsp; &lt;input type=3D'reset'/&gt;<br>
</div>
<div>&nbsp; &nbsp; &lt;/form&gt;<br>
</div>
<div>&lt;/body&gt; &lt;/html&gt;</div>
<div><br>
</div>
<div>If a file hasn't been chosen the submition doesn't seem to work.</div>
<div>If a file is chosen i get a proper error from the server (&quot;not fo=
und&quot;).<br>
</div>
<span></span><br>
</div>
<hr tabindex=3D"-1" style=3D"display:inline-block; width:98%">
<div id=3D"divRplyFwdMsg" dir=3D"ltr"><font style=3D"font-size:11pt" face=
=3D"Calibri, sans-serif" color=3D"#000000"><b>From:</b> Basil L. Contovoune=
sios &lt;contovob@HIDDEN&gt;<br>
<b>Sent:</b> Sunday, July 7, 2019 19:38<br>
<b>To:</b> Ivaylo Ilionov<br>
<b>Cc:</b> 36520 <at> debbugs.gnu.org<br>
<b>Subject:</b> Re: bug#36520: Form submition in eww doesn't work if file f=
ield is left empty</font>
<div>&nbsp;</div>
</div>
<div class=3D"BodyFragment"><font size=3D"2"><span style=3D"font-size:11pt"=
>
<div class=3D"PlainText">tags 36520 &#43; patch<br>
quit<br>
<br>
Ivaylo Ilionov &lt;ivaylo.ilionov@HIDDEN&gt; writes:<br>
<br>
&gt; When submitting form with various fields including one optional<br>
&gt; field for file upload, if the file filed is left empty - the<br>
&gt; submition doesn't work.<br>
&gt;<br>
&gt; The error is: Wrong type argument: stringp, nil<br>
<br>
Could you please give an example of such a form, for<br>
reproduction/testing purposes?<br>
<br>
&gt; I've tracked the problem to the function 'eww-submit' which tries<br>
&gt; to open a file for upload (the file was never initialized by the<br>
&gt; html form).<br>
<br>
I wonder if the file not being initialised is a symptom of a problem<br>
elsewhere?&nbsp; An example might shed more light on this.<br>
<br>
&gt; My fix is to check if the property is set in the file &quot;eww.el.gz&=
quot; after<br>
&gt; line 1435:<br>
&gt;<br>
&gt;&gt; ((equal (plist-get input :type) &quot;file&quot;)<br>
&gt;&gt;&nbsp; ;; FIX check if property :filename is not nil<br>
&gt;&gt;&nbsp; (when (not (null (plist-get input :filename)))<br>
<br>
FWIW, this is equivalent to (when (plist-get input :filename) ...).<br>
<br>
&gt;&gt;&nbsp;&nbsp;&nbsp; (push (cons &quot;file&quot;<br>
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (list (cons &quot;=
filedata&quot;<br>
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (with-temp-buffer<br>
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (insert-file-conte=
nts<br>
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (plist-get i=
nput :filename))<br>
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (buffer-string)))<=
br>
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (cons &quot;name&quot; (=
plist-get input :name))<br>
&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (cons &quot;filename&quo=
t; (plist-get input :filename))))<br>
&gt;&gt;&nbsp;&nbsp; values)))<br>
<br>
LGTM.&nbsp; Here's a patch which achieves the same effect and additionally<=
br>
cleans up this code a tiny bit:<br>
<br>
</div>
</span></font></div>
</div>
</body>
</html>

--_000_VE1PR08MB5136AAF0D6D0F395E997E85F82F70VE1PR08MB5136eurp_--




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#36520: Form submition in eww doesn't work if file field is left empty
Resent-From: Lars Ingebrigtsen <larsi@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sat, 14 Sep 2019 14:57:01 +0000
Resent-Message-ID: <handler.36520.B36520.156847296312487 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 36520
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
To: "Basil L. Contovounesios" <contovob@HIDDEN>
Cc: 36520 <at> debbugs.gnu.org, Ivaylo Ilionov <ivaylo.ilionov@HIDDEN>
Received: via spool by 36520-submit <at> debbugs.gnu.org id=B36520.156847296312487
          (code B ref 36520); Sat, 14 Sep 2019 14:57:01 +0000
Received: (at 36520) by debbugs.gnu.org; 14 Sep 2019 14:56:03 +0000
Received: from localhost ([127.0.0.1]:47028 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1i99T1-0003FL-5M
	for submit <at> debbugs.gnu.org; Sat, 14 Sep 2019 10:56:03 -0400
Received: from quimby.gnus.org ([80.91.231.51]:36564)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1i99Sz-0003Eu-3I
 for 36520 <at> debbugs.gnu.org; Sat, 14 Sep 2019 10:56:01 -0400
Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=marnie)
 by quimby.gnus.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.89) (envelope-from <larsi@HIDDEN>)
 id 1i99Su-0001BM-Ue; Sat, 14 Sep 2019 16:55:59 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
References: <VE1PR08MB513653BD4614A51CADF8E27C82F40@HIDDEN>
 <87d0iler5r.fsf@HIDDEN>
Date: Sat, 14 Sep 2019 16:55:56 +0200
In-Reply-To: <87d0iler5r.fsf@HIDDEN> (Basil L. Contovounesios's message of
 "Sun, 07 Jul 2019 17:38:24 +0100")
Message-ID: <87muf76i6b.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview:  "Basil L. Contovounesios" <contovob@HIDDEN> writes: > This
 is probably fine to push as-is, as it's just a defensive guard, but > I'd
 rather get confirmation from someone else or play around with an > example
 of the bug first. 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

"Basil L. Contovounesios" <contovob@HIDDEN> writes:

> This is probably fine to push as-is, as it's just a defensive guard, but
> I'd rather get confirmation from someone else or play around with an
> example of the bug first.

I did some testing, and it seemed to work fine for me, so I've applied
it to the trunk and pushed it.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Message received at control <at> debbugs.gnu.org:


Received: (at control) by debbugs.gnu.org; 14 Sep 2019 14:56:07 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 14 10:56:07 2019
Received: from localhost ([127.0.0.1]:47031 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1i99T5-0003Fc-EM
	for submit <at> debbugs.gnu.org; Sat, 14 Sep 2019 10:56:07 -0400
Received: from quimby.gnus.org ([80.91.231.51]:36584)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1i99T3-0003FU-Ts
 for control <at> debbugs.gnu.org; Sat, 14 Sep 2019 10:56:06 -0400
Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=marnie)
 by quimby.gnus.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.89) (envelope-from <larsi@HIDDEN>) id 1i99T1-0001BY-6u
 for control <at> debbugs.gnu.org; Sat, 14 Sep 2019 16:56:05 +0200
Date: Sat, 14 Sep 2019 16:56:02 +0200
Message-Id: <87lfur6i65.fsf@HIDDEN>
To: control <at> debbugs.gnu.org
From: Lars Ingebrigtsen <larsi@HIDDEN>
Subject: control message for bug #36520
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview:  tags 36520 fixed close 36520 27.1 quit 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: control
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

tags 36520 fixed
close 36520 27.1
quit





Message received at control <at> debbugs.gnu.org:


Received: (at control) by debbugs.gnu.org; 14 Sep 2019 14:56:07 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 14 10:56:07 2019
Received: from localhost ([127.0.0.1]:47031 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1i99T5-0003Fc-EM
	for submit <at> debbugs.gnu.org; Sat, 14 Sep 2019 10:56:07 -0400
Received: from quimby.gnus.org ([80.91.231.51]:36584)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1i99T3-0003FU-Ts
 for control <at> debbugs.gnu.org; Sat, 14 Sep 2019 10:56:06 -0400
Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=marnie)
 by quimby.gnus.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.89) (envelope-from <larsi@HIDDEN>) id 1i99T1-0001BY-6u
 for control <at> debbugs.gnu.org; Sat, 14 Sep 2019 16:56:05 +0200
Date: Sat, 14 Sep 2019 16:56:02 +0200
Message-Id: <87lfur6i65.fsf@HIDDEN>
To: control <at> debbugs.gnu.org
From: Lars Ingebrigtsen <larsi@HIDDEN>
Subject: control message for bug #36520
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview:  tags 36520 fixed close 36520 27.1 quit 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: control
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

tags 36520 fixed
close 36520 27.1
quit






Last modified: Sat, 14 Sep 2019 15:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.