-
Notifications
You must be signed in to change notification settings - Fork 65
Add HttpPostedFile*. #260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add HttpPostedFile*. #260
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
public IList<HttpPostedFile> GetMultiple(string name) => FormFiles.GetFiles(name) is { Count: > 0 } files ? new ReadOnlyPostedFileCollection(files) : Array.Empty<HttpPostedFile>(); | ||
|
||
public HttpPostedFile? this[string name] => Get(name); | ||
|
||
public HttpPostedFile? this[int index] => Get(index); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Tratcher I think this is the first of the namevaluecollection types we can actually fully conform - I hadn't realized IFormFileCollection had a this[int index]
parameter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ha, yeah, it's a full IReadOnlyList.
|
||
namespace System.Web; | ||
|
||
public class HttpPostedFileWrapper : HttpPostedFileBase |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we making all of the wrapper types public? Why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a public API from .NET Framework: https://learn.microsoft.com/en-us/dotnet/api/system.web.httppostedfilewrapper?view=netframework-4.8.1
It's a convention used for a number of types. Most common is HttpContext
which has no virtual methods. HttpContextBase
was an abstraction for it. HttpContextWrapper
wrapped HttpContext
to HttpContextBase
.
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
@johnLwith this is approved, but we've updated to start using .NET 8 SDK, and it enabled new warnings. Can you address them and then we'll merge it in |
@johnLwith do you think you'll be able to address the errors in the build? |
|
||
public abstract class HttpPostedFileBase | ||
{ | ||
public virtual string FileName => throw new NotImplementedException(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@johnLwith for these kind of warnings/errors, suppress with an attribute, and use the justification of Constants.ApiFromAspNet
@johnLwith will you be able to address the build error? |
@johnLwith I went ahead and pushed a fix to your branch with the missing attributes |
Add missing property of File in HttpRequest.
Fixes #141