31 writes to FileName
Microsoft.Net.Http.Headers (3)
ContentDispositionHeaderValue.cs (3)
204
FileName
= Sanitize(fileName);
208
FileName
= fileName;
221
FileName
= fileName;
Microsoft.Net.Http.Headers.Tests (28)
ContentDispositionHeaderValueTest.cs (28)
118
contentDisposition.
FileName
= "new_name";
132
contentDisposition.
FileName
= "FileÃName.bat";
147
contentDisposition.
FileName
= "File\nName.bat";
170
contentDisposition.
FileName
= "new_name";
400
contentDisposition.
FileName
= "my File Name";
420
contentDisposition.
FileName
= null;
491
expected.
FileName
= "foo-ae.html";
548
{ @"inline; filename=""foo.html""", new ContentDispositionHeaderValue("inline") {
FileName
= @"""foo.html""" } },
549
{ @"inline; filename=""Not an attachment!""", new ContentDispositionHeaderValue("inline") {
FileName
= @"""Not an attachment!""" } }, // 'inline', specifying a filename of Not an attachment! - this checks for proper parsing for disposition types.
550
{ @"inline; filename=""foo.pdf""", new ContentDispositionHeaderValue("inline") {
FileName
= @"""foo.pdf""" } },
553
{ @"attachment; filename=""foo.html""", new ContentDispositionHeaderValue("attachment") {
FileName
= @"""foo.html""" } },
554
{ @"attachment; filename=""\""quoting\"" tested.html""", new ContentDispositionHeaderValue("attachment") {
FileName
= "\"\"quoting\" tested.html\"" } }, // 'attachment', specifying a filename of \"quoting\" tested.html (using double quotes around "quoting" to test... quoting)
555
{ @"attachment; filename=""Here's a semicolon;.html""", new ContentDispositionHeaderValue("attachment") {
FileName
= @"""Here's a semicolon;.html""" } }, // , 'attachment', specifying a filename of Here's a semicolon;.html - this checks for proper parsing for parameters.
556
{ @"attachment; foo=""bar""; filename=""foo.html""", new ContentDispositionHeaderValue(@"attachment") {
FileName
= @"""foo.html""", Parameters = { new NameValueHeaderValue("foo", @"""bar""") } } }, // 'attachment', specifying a filename of foo.html and an extension parameter "foo" which should be ignored (see <a href="http://greenbytes.de/tech/webdav/rfc2183.html#rfc.section.2.8">Section 2.8 of RFC 2183</a>.).
557
{ @"attachment; foo=""\""\\"";filename=""foo.html""", new ContentDispositionHeaderValue(@"attachment") {
FileName
= @"""foo.html""", Parameters = { new NameValueHeaderValue("foo", @"""\""\\""") } } }, // 'attachment', specifying a filename of foo.html and an extension parameter "foo" which should be ignored (see <a href="http://greenbytes.de/tech/webdav/rfc2183.html#rfc.section.2.8">Section 2.8 of RFC 2183</a>.). The extension parameter actually uses backslash-escapes. This tests whether the UA properly skips the parameter.
558
{ @"attachment; FILENAME=""foo.html""", new ContentDispositionHeaderValue("attachment") {
FileName
= @"""foo.html""" } },
559
{ @"attachment; filename=foo.html", new ContentDispositionHeaderValue("attachment") {
FileName
= "foo.html" } }, // 'attachment', specifying a filename of foo.html using a token instead of a quoted-string.
560
{ @"attachment; filename='foo.bar'", new ContentDispositionHeaderValue("attachment") {
FileName
= "'foo.bar'" } }, // 'attachment', specifying a filename of 'foo.bar' using single quotes.
562
{ @"attachment; filename=""foo-ä.html""", new ContentDispositionHeaderValue("attachment") {
FileName
= @"""foo-ä.html""" } }, // 'attachment', specifying a filename of foo-ä.html, which happens to be foo-ä.html using UTF-8 encoding.
568
{ @"attachment; filename=""foo-%c3%a4-%e2%82%ac.html""", new ContentDispositionHeaderValue("attachment") {
FileName
= @"""foo-%c3%a4-%e2%82%ac.html""" } }, // 'attachment', specifying a filename of foo-%c3%a4-%e2%82%ac.html, using raw percent encoded UTF-8 to represent foo-ä-€.html
569
{ @"attachment; filename =""foo.html""", new ContentDispositionHeaderValue("attachment") {
FileName
= @"""foo.html""" } },
571
{ @"attachment; filename=""/foo.html""", new ContentDispositionHeaderValue("attachment") {
FileName
= @"""/foo.html""" } },
584
{ @"attachment; filename=""foo-ae.html""; filename*=UTF-8''foo-%c3%a4.html", new ContentDispositionHeaderValue("attachment") {
FileName
= @"""foo-ae.html""", FileNameStar = "foo-ä.html" } },
585
{ @"attachment; filename*=UTF-8''foo-%c3%a4.html; filename=""foo-ae.html""", new ContentDispositionHeaderValue("attachment") { FileNameStar = "foo-ä.html",
FileName
= @"""foo-ae.html""" } },
586
{ @"attachment; foobar=x; filename=""foo.html""", new ContentDispositionHeaderValue("attachment") {
FileName
= @"""foo.html""", Parameters = { new NameValueHeaderValue("foobar", "x") } } },
587
{ @"attachment; filename=""=?ISO-8859-1?Q?foo-=E4.html?=""", new ContentDispositionHeaderValue("attachment") {
FileName
= @"""=?ISO-8859-1?Q?foo-=E4.html?=""" } }, // attachment; filename="=?ISO-8859-1?Q?foo-=E4.html?="
588
{ @"attachment; filename=""=?utf-8?B?Zm9vLeQuaHRtbA==?=""", new ContentDispositionHeaderValue("attachment") {
FileName
= @"""=?utf-8?B?Zm9vLeQuaHRtbA==?=""" } }, // attachment; filename="=?utf-8?B?Zm9vLeQuaHRtbA==?="
589
{ @"attachment; filename=foo.html ;", new ContentDispositionHeaderValue("attachment") {
FileName
="foo.html" } }, // 'attachment', specifying a filename of foo.html using a token instead of a quoted-string, and adding a trailing semicolon.,
16 references to FileName
Microsoft.AspNetCore.WebUtilities (1)
FileMultipartSection.cs (1)
44
_contentDispositionHeader.
FileName
).ToString();
Microsoft.Net.Http.Headers (2)
ContentDispositionHeaderValueIdentityExtensions.cs (2)
23
&& (!StringSegment.IsNullOrEmpty(header.
FileName
) || !StringSegment.IsNullOrEmpty(header.FileNameStar));
36
&& StringSegment.IsNullOrEmpty(header.
FileName
) && StringSegment.IsNullOrEmpty(header.FileNameStar);
Microsoft.Net.Http.Headers.Tests (13)
ContentDispositionHeaderValueTest.cs (13)
48
Assert.Null(contentDisposition.
FileName
.Value);
119
Assert.Equal("new_name", contentDisposition.
FileName
.AsSpan());
124
Assert.Null(contentDisposition.
FileName
.Value);
133
Assert.Equal("FileÃName.bat", contentDisposition.
FileName
.AsSpan());
139
Assert.Null(contentDisposition.
FileName
.Value);
148
Assert.Equal("File\nName.bat", contentDisposition.
FileName
.AsSpan());
154
Assert.Null(contentDisposition.
FileName
.Value);
168
Assert.Equal("=?utf-99?Q?R=mlsZcODTmFtZS5iYXQ=?=", contentDisposition.
FileName
.AsSpan());
171
Assert.Equal("new_name", contentDisposition.
FileName
.AsSpan());
176
Assert.Null(contentDisposition.
FileName
.Value);
297
Assert.Equal(expectedFileName.AsSpan(), contentDisposition.
FileName
);
649
Assert.Equal(expectedFileName.AsSpan(), result.
FileName
);
658
Assert.Equal("File __ name.txt", contentDisposition.
FileName
.AsSpan());