Subject: [Tools-discuss] Uploading a Markdown agenda

From: Yaron Sheffer <[email-masked]>
Date: Tue, 17 Mar 2020 09:29:53 +0200

Hi,

I’m trying to upload a Markdown agenda to the meeting materials page (“.md” file, created with Typora on Mac), and I’m getting a nice red “Upload Content-Type (application/octet-stream) is different from the observed mime-type (text/plain).” Any ideas?

Thanks,

                Yaron

---

From: Henrik Levkowetz <[email-masked]>
Date: Tue, 17 Mar 2020 13:57:23 +0100

Hi Yaron,

This could be an encoding matter, or something else.  If you send me the
file, I'll debug.  (See also below in the list signature for where to report
datatracker bugs).

Regards,

	Henrik

On 2020-03-17 08:29, Yaron Sheffer wrote:
> Hi,
> 
>  
> 
> I’m trying to upload a Markdown agenda to the meeting materials page (“..md” file, created with Typora on Mac), and I’m getting a nice red “Upload Content-Type (application/octet-stream) is different from the observed mime-type (text/plain).” Any ideas?
> 
>  
> 
> Thanks,
> 
>                 Yaron
> 
> 
> 
> 
> ___________________________________________________________
> Tools-discuss mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/tools-discuss
> 
> Please report datatracker.ietf.org and mailarchive.ietf.org
> bugs at http://tools.ietf.org/tools/ietfdb
> or send email to [email-masked]
> 
> Please report tools.ietf.org bugs at
> http://tools.ietf.org/tools/issues
> or send email to [email-masked]
>

---

From: Michael Richardson <[email-masked]>
Date: Tue, 17 Mar 2020 18:21:15 -0400

rename your markdown file to end in .txt.

Your browser does not think it's a text file, so it it setting the
content-type to application/octet-stream, and the framework is reasonably
saying "no"

This is basically a browser UI limitation.
It doesn't know what .md is, or how to tag it. (And the Internet really
shouldn't guess)

--
Michael Richardson <[email-masked]>, Sandelman Software Works
 -= IPv6 IoT consulting =-

---

From: Yaron Sheffer <[email-masked]>
Date: Wed, 18 Mar 2020 00:23:59 +0200

But then how would the server know that this is Markdown, and should be rendered as such?

Thanks,
	Yaron

On 3/18/20, 00:21, "Michael Richardson" <[email-masked]> wrote:

---

From: Tom Pusateri <[email-masked]>
Date: Tue, 17 Mar 2020 18:47:56 -0400

> On Mar 17, 2020, at 6:21 PM, Michael Richardson <[email-masked]> wrote:
> 
> 

I don’t think this is correct. I tested this with several browsers when I implemented it and uploading .md files are the correct way to get the text/markdown mime type associated with the file.

The datatracker would just accept it as text/markdown directly except for there is a post check to ensure the file isn’t secretly something else. This post check expects it to be text/plain and it isn’t. This could be a problem with the checking library, the file itself, or some yet unknown issue.

As Henrik said, send in the file.

Also, since you’re on a Mac, if you go to the terminal and type:

% file foo.md

and let us know what it returns.

It should say:

foo.md: ASCII text

Tom

---

From: Carsten Bormann <[email-masked]>
Date: Wed, 18 Mar 2020 00:15:41 +0100

> On 17. Mar 2020, at 23:48, Tom Pusateri <pusateri=[email-masked]> wrote:
> 
> foo.md: ASCII text

If it happens to be ascii, which markdown often isn’t. 

Grüße, Carsten

---

From: Tom Pusateri <[email-masked]>
Date: Tue, 17 Mar 2020 19:21:38 -0400

> On Mar 17, 2020, at 7:15 PM, Carsten Bormann <[email-masked]> wrote:
> 
> 

Yes, good point. If it’s UTF-8, it will show:

% file foo.md
foo.md: UTF-8 Unicode text

Another helpful command would be:

% od -c foo.md

Tom

---

From: Yaron Sheffer <[email-masked]>
Date: Wed, 18 Mar 2020 10:11:46 +0200

I think it's a local problem on my Mac (which unfortunately I don't know how to resolve).

$ file  ~/Desktop/TxAuth\ agenda.md 
/Users/ysheffer/Desktop/TxAuth agenda.md: ASCII text

$ file --mime-type ~/Desktop/TxAuth\ agenda.md 
/Users/ysheffer/Desktop/TxAuth agenda.md: text/plain

And Mac's "Get Info" shows the file "kind" as: "md 文件" (MD followed by two Chinese characters, don't ask me).

Thanks,
	Yaron

On 3/18/20, 01:21, "Tools-discuss on behalf of Tom Pusateri" <[email-masked] on behalf of pusateri=[email-masked]> wrote:

    
    
    % file foo.md

    % od -c foo.md
    
    Tom

---

From: Julian Reschke <[email-masked]>
Date: Wed, 18 Mar 2020 11:24:54 +0100

> And Mac's "Get Info" shows the file "kind" as: "md 文件" (MD followed by two Chinese characters, don't ask me).

What's relevant should be the POST request (and what content-type is
sent there). Could you capture that request?

Best regards, Julian

---

From: Julian Reschke <[email-masked]>
Date: Wed, 18 Mar 2020 12:54:05 +0100

On 18.03.2020 12:51, Yaron Sheffer wrote:
> It's a multipart form. First part is a CSRF token. Second part says:
>
> Content-Disposition: form-data; name="file"; filename="TxAuth agenda.md"
> Content-Type: application/octet-stream
>
> Thanks,
> 	Yaron

So the browser (or the OS) does not know the file type, thus sends
"application/octet-stream". (which, IMHO, is the wrong choice)

Did you try with a different browser yet?

Best regards, Julian

---

From: Yaron Sheffer <[email-masked]>
Date: Wed, 18 Mar 2020 13:54:51 +0200

Yes. Same failure mode with Chrome.

On 3/18/20, 13:54, "Julian Reschke" <[email-masked]> wrote:

    
    
    Best regards, Julian

---

From: Carsten Bormann <[email-masked]>
Date: Wed, 18 Mar 2020 12:55:20 +0100

Many of us won’t have that problem because we associated .md to a markdown application at the “Finder” level.

Grüße, Carsten

> On 2020-03-18, at 12:54, Julian Reschke <[email-masked]> wrote:
>

---

From: Yaron Sheffer <[email-masked]>
Date: Wed, 18 Mar 2020 14:52:13 +0200

The Mac is a weird weird place. I have actually associated ".md" with a Markdown application (Typora). But the Mac's "file kind" is yet another orthogonal file attribute, and I haven't been unable to change it.

On 3/18/20, 13:55, "Carsten Bormann" <[email-masked]> wrote:

    Grüße, Carsten

---

From: Carsten Bormann <[email-masked]>
Date: Wed, 18 Mar 2020 15:02:42 +0100

On 2020-03-18, at 13:52, Yaron Sheffer <[email-masked]> wrote:
> 
> The Mac is a weird weird place.

I’m not claiming I understand it…

In any case, reacting on the purported media type of something uploaded by a browser of undefined configuration does not strike me as a winning strategy.

Grüße, Carsten

---

From: Michael Richardson <[email-masked]>
Date: Wed, 18 Mar 2020 12:04:38 -0400

> But then how would the server know that this is Markdown, and should be

I dunno.
I think that text files are all subsets of markdown?

---

From: Warren Kumari <[email-masked]>
Date: Wed, 18 Mar 2020 12:44:06 -0400

On Wed, Mar 18, 2020 at 8:53 AM Yaron Sheffer <[email-masked]> wrote:
>
> The Mac is a weird weird place. I have actually associated ".md" with a Markdown application (Typora).

... not that I'm hijacking a thread or anything, but, for those who
haven't tried it, Typora is an awesome markdown editor...
I've tried a bunch of them, and Typora wins by far (for me)

W

> But the Mac's "file kind" is yet another orthogonal file attribute, and I haven't been unable to change it.
>

-- 
I don't think the execution is relevant when it was obviously a bad
idea in the first place.
This is like putting rabid weasels in your pants, and later expressing
regret at having chosen those particular rabid weasels and that pair
of pants.
   ---maf

---

From: Tom Pusateri <[email-masked]>
Date: Wed, 18 Mar 2020 13:59:23 -0400

> On Mar 18, 2020, at 10:02 AM, Carsten Bormann <[email-masked]> wrote:
> 

I think the current strategy employed by the datatracker is actually ok. I don’t quite understand what is happening on Yaron’s Mac but we can figure it out.

In any event, the design is that files ending with .md are recognized as mime-type text/markdown

Maybe I got this by installing Xcode but this does seem to be the case in the Finder Get Info window.

This is uploaded by the browser as text/markdown and then the datatracker runs a python program that guesses what the mime type is based on the actual content.

If it guesses that the actual content is text/plain and the mime type is set to text/markdown, then it is accepted as text/markdown.

This is why I suggested running the unix file command because it also guesses on the type based on the content, unlike the assigned mime-type based on the file extension.

Yaron, if you open the directory containing your markdown file in the Finder and select it hit CMD-I (Info), what is the Kind report as and what application does it open with by default?

Thanks,
Tom

---

From: Yaron Sheffer <[email-masked]>
Date: Wed, 18 Mar 2020 20:06:07 +0200

Hi Tom,

The Kind shows as "md 文件" (MD, space, then two Chinese characters). I frankly have no idea how that happened. The default application is Typora, a common Markdown editor.

Sadly, the browser sends it on the POST message with: Content-Type: application/octet-stream

Thanks,
	Yaron

    

    

    
    
    Thanks,
    Tom

---

From: Henrik Levkowetz <[email-masked]>
Date: Wed, 18 Mar 2020 19:13:56 +0100

Hi Yaron,

> The Kind shows as "md 文件" (MD, space, then two Chinese characters). I frankly have no idea how that happened. The default application is Typora, a common Markdown editor.

Heh.  Just looked up "文件".  Google translate says it's Chinese and means
"file".  So you have Chinese .md files ,,;-)

Seriously, I'll have a look at providing better support for working around
this, from the datatracker end.

Best regards,

	Henrik

---

From: Yaron Sheffer <[email-masked]>
Date: Wed, 18 Mar 2020 13:51:22 +0200

Thanks,
	Yaron

On 3/18/20, 12:25, "Julian Reschke" <[email-masked]> wrote:

    
    Best regards, Julian