-
Notifications
You must be signed in to change notification settings - Fork 40
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
Extensions with period #27
Comments
I'm in two minds about this one. It probably does make sense to align with the way that I'm tempted to leave this issue open for a little while to give a chance to hear some more opinons on this. |
I totally understand. Maybe this is something you just want to hang onto until the next major release, rather than making a major release just for this. Two other possibilities would be a static property, something like I'm happy to work on a PR if you like one of those approaches. |
Totally useless comment: I'm ambivalent, either way. As long as I know how it works in any given version, I'm fine with the change. Might be nice to match |
@tiesont It's useful to hear that it wouldn't break what your use case, so thanks for the feedback :) I've thought about this a bit over the weekend, and I'm inclined to change it. Having consistency with the standard libraries would help to make the usage more predicable, so that's probably a good enough reason to change it. I also had a look at some of the other System.IO APIs, @asherber Thanks for the suggestion, but to make that work I'd have to make the formats mutable (either at the static or instance level) to make the option work which doesn't really appeal - I prefer having the formats fixed as immutable types (because a format doesn't change). I think what I'd prefer to do is just accept the breaking change and include the period in the definitions of each format. |
If I may leave an opinion, at this point it's been 2 years, and this library has quite some download in nuget, so i'll err on the side of don't break existing app. string extension = Path.GetExtension(file.FileName).TrimStart('.');
if (_allowedImageType.Select(q => q.Extension).Distinct().Contains(extension, StringComparer.InvariantCultureIgnoreCase) == false)
{
throw new BadHttpRequestException("Bad file extension");
} |
Thanks for this useful library!
I know this would be a breaking change, but I'd like to suggest that the values in
FileFormat.Extension
should start with a period, just like the output ofPath.GetExtension()
-- and like the table in this repo's README.The text was updated successfully, but these errors were encountered: