Closed Tratcher closed 6 years ago
What API are you using to send the file? an MVC FileResult?
// GET: api/values
[HttpGet]
public async Task<IActionResult> Get()
{
// ...
var memory = new MemoryStream();
using (var stream = new FileStream(path, FileMode.Open))
{
await stream.CopyToAsync(memory);
}
memory.Position = 0;
return File(memory, "application/octet-stream", lastetUpdate.Name);
}
(Unrelated) Why isn't that just?
return PhysicalFile(path, "application/octet-stream", lastetUpdate.Name);
See https://tools.ietf.org/html/rfc6266#section-4.1. filename may either be a token or a quoted string. filename*'s format does not use quotes.
filename-parm = "filename" "=" value
| "filename*" "=" ext-value
token = <token, defined in [RFC2616], Section 2.2>
quoted-string = <quoted-string, defined in [RFC2616], Section 2.2>
value = <value, defined in [RFC2616], Section 3.6>
; token | quoted-string
ext-value = charset "'" [ language ] "'" value-chars
; like RFC 2231's <extended-initial-value>
; (see [RFC2231], Section 7)
Ok, thx. Then in this case this is not a bug? Sorry for the noise!
Qt 4.8 had issues to parse this, This is why I came to this conclusion and the mozilla reference, of course.
This issue was moved to aspnet/Home#2677
From @Petermarcu on November 27, 2017 5:1
@StefanoD opened this here: https://github.com/dotnet/core/issues/1106
According to https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition the parameters of the content disposition header must be quoted. Instead APS.Net Core sends them without quote:
attachment; filename=latest_bin.txt; filename*=UTF-8''latest_bin.txt
I'm using .Net Core 2.0
Copied from original issue: aspnet/Home#2288