From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from yow.a-b.xyz ([45.32.152.219]) by ewsd; Fri Nov 22 06:28:04 EST 2019 Received: by yow.a-b.xyz (OpenSMTPD) with ESMTPSA id fce49d12 (TLSv1.2:ECDHE-RSA-AES256-SHA:256:NO) for <9front@9front.org>; Fri, 22 Nov 2019 12:27:56 +0100 (CET) Message-ID: <6EA09345485B52EFE6F64A885C95538E@a-b.xyz> To: 9front@9front.org Subject: upas/marshal fix extension parsing Date: Fri, 22 Nov 2019 12:27:54 +0100 From: kvik@a-b.xyz MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="upas-ckpkeilxrzksrkosgkjyuzwqck" List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: progressive agile plugin This is a multi-part message in MIME format. --upas-ckpkeilxrzksrkosgkjyuzwqck Content-Disposition: inline Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit While handling attachments upas/marshal first looks at the file extension which it matches against a built-in list and then against the system mimelist. Both of those currently contain only single-component extensions such as '.tgz' but marshal uses anything after the first '.' in the name as an extension, probably in anticipation for '.tar.gz' and similar. This patch changes marshal to match the last '.' delimited component. --upas-ckpkeilxrzksrkosgkjyuzwqck Content-Disposition: inline Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit diff -r 8b2040ba4785 sys/src/cmd/upas/marshal/marshal.c --- a/sys/src/cmd/upas/marshal/marshal.c Fri Nov 22 17:29:35 2019 +1030 +++ b/sys/src/cmd/upas/marshal/marshal.c Fri Nov 22 11:59:56 2019 +0100 @@ -902,7 +902,7 @@ } /* pick a type depending on extension */ - p = strchr(file, '.'); + p = strrchr(file, '.'); if(p != nil) p++; --upas-ckpkeilxrzksrkosgkjyuzwqck--