From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 06 07:28:27 2019 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 ) id 1hjirh-0007xN-Qx for submit@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 ) id 1hji6h-0006oh-3r for submit@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 ) id 1hji6f-00053k-RD for bug-gnu-emacs@gnu.org; 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 ) id 1hji6e-0002R8-K4 for bug-gnu-emacs@gnu.org; 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 ) id 1hji6e-0002Jj-5D for bug-gnu-emacs@gnu.org; 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 To: "bug-gnu-emacs@gnu.org" Subject: Form submition in eww doesn't work if file field is left empty 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: 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-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Sat, 06 Jul 2019 07:28:24 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" 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
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&= quot; 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 inpu= t :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.1200= 4000
System Description: Debian GNU/Linux 10 (buster)

--_000_VE1PR08MB513653BD4614A51CADF8E27C82F40VE1PR08MB5136eurp_-- From debbugs-submit-bounces@debbugs.gnu.org Sun Jul 07 12:38:39 2019 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 ) id 1hkABT-0005Jo-Gs for submit@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 ) id 1hkABQ-0005JP-Ol for 36520@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@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" To: Ivaylo Ilionov Subject: Re: bug#36520: Form submition in eww doesn't work if file field is left empty References: Date: Sun, 07 Jul 2019 17:38:24 +0100 In-Reply-To: (Ivaylo Ilionov's message of "Sat, 6 Jul 2019 10:39:41 +0000") Message-ID: <87d0iler5r.fsf@tcd.ie> 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 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-Debbugs-Envelope-To: 36520 Cc: 36520@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) --=-=-= Content-Type: text/plain tags 36520 + patch quit Ivaylo Ilionov 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" 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 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sun Jul 07 17:16:27 2019 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 ) id 1hkEWH-0008EQ-Mw for submit@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 ) id 1hkEDm-0007i3-H4 for 36520@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 To: "Basil L. Contovounesios" Subject: Re: bug#36520: Form submition in eww doesn't work if file field is left empty 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: References: , <87d0iler5r.fsf@tcd.ie> In-Reply-To: <87d0iler5r.fsf@tcd.ie> 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-Debbugs-Envelope-To: 36520 X-Mailman-Approved-At: Sun, 07 Jul 2019 17:16:24 -0400 Cc: "36520@debbugs.gnu.org" <36520@debbugs.gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --_000_VE1PR08MB5136AAF0D6D0F395E997E85F82F70VE1PR08MB5136eurp_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Basil L. Contovounesios 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:
Short comment:
Optional file:

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 Sent: Sunday, July 7, 2019 19:38 To: Ivaylo Ilionov Cc: 36520@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 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
Basil L. Contovounesios <contovob@tcd.ie> writes:
> I wonder if the file n= ot 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 conta= ins
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'fi= le' /><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 fo= und").


From: Basil L. Contovoune= sios <contovob@tcd.ie>
Sent: Sunday, July 7, 2019 19:38
To: Ivaylo Ilionov
Cc: 36520@debbugs.gnu.org
Subject: Re: bug#36520: Form submition in eww doesn't work if file f= ield is left empty
 
tags 36520 + patch
quit

Ivaylo Ilionov <ivaylo.ilionov@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&= quot; 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-conte= nts
>>          (plist-get i= nput :filename))
>>         (buffer-string)))<= br> >>        (cons "name" (= plist-get input :name))
>>        (cons "filename&quo= t; (plist-get input :filename))))
>>   values)))

LGTM.  Here's a patch which achieves the same effect and additionally<= br> cleans up this code a tiny bit:

--_000_VE1PR08MB5136AAF0D6D0F395E997E85F82F70VE1PR08MB5136eurp_-- From debbugs-submit-bounces@debbugs.gnu.org Sat Sep 14 10:56:03 2019 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 ) id 1i99T1-0003FL-5M for submit@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 ) id 1i99Sz-0003Eu-3I for 36520@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 ) id 1i99Su-0001BM-Ue; Sat, 14 Sep 2019 16:55:59 +0200 From: Lars Ingebrigtsen To: "Basil L. Contovounesios" Subject: Re: bug#36520: Form submition in eww doesn't work if file field is left empty References: <87d0iler5r.fsf@tcd.ie> Date: Sat, 14 Sep 2019 16:55:56 +0200 In-Reply-To: <87d0iler5r.fsf@tcd.ie> (Basil L. Contovounesios's message of "Sun, 07 Jul 2019 17:38:24 +0100") Message-ID: <87muf76i6b.fsf@gnus.org> 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" 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-Debbugs-Envelope-To: 36520 Cc: 36520@debbugs.gnu.org, Ivaylo Ilionov X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) "Basil L. Contovounesios" 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 From debbugs-submit-bounces@debbugs.gnu.org Sat Sep 14 10:56:07 2019 Received: (at control) by debbugs.gnu.org; 14 Sep 2019 14:56:07 +0000 Received: from localhost ([127.0.0.1]:47031 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i99T5-0003Fc-EM for submit@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 ) id 1i99T3-0003FU-Ts for control@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 ) id 1i99T1-0001BY-6u for control@debbugs.gnu.org; Sat, 14 Sep 2019 16:56:05 +0200 Date: Sat, 14 Sep 2019 16:56:02 +0200 Message-Id: <87lfur6i65.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen 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@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tags 36520 fixed close 36520 27.1 quit From unknown Fri Jun 13 11:24:38 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 13 Oct 2019 11:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator