9front - general discussion about 9front
 help / color / mirror / Atom feed
From: kvik@a-b.xyz
To: 9front@9front.org
Subject: upas/marshal fix extension parsing
Date: Fri, 22 Nov 2019 12:27:54 +0100	[thread overview]
Message-ID: <6EA09345485B52EFE6F64A885C95538E@a-b.xyz> (raw)

[-- Attachment #1: Type: text/plain, Size: 431 bytes --]

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.

[-- Attachment #2: Type: text/plain, Size: 344 bytes --]

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++;
 

                 reply	other threads:[~2019-11-22 11:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6EA09345485B52EFE6F64A885C95538E@a-b.xyz \
    --to=kvik@a-b.xyz \
    --cc=9front@9front.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).