1
0
mirror of https://github.com/bitwarden/server synced 2025-12-10 13:23:27 +00:00

Changed all C# control flow block statements to include space between keyword and open paren

This commit is contained in:
Chad Scharf
2020-03-27 14:36:37 -04:00
parent 943aea9a12
commit 9800b752c0
243 changed files with 2258 additions and 2258 deletions

View File

@@ -20,36 +20,36 @@ namespace Bit.Api.Utilities
var reader = new MultipartReader(boundary, request.Body);
var firstSection = await reader.ReadNextSectionAsync();
if(firstSection != null)
if (firstSection != null)
{
if(ContentDispositionHeaderValue.TryParse(firstSection.ContentDisposition, out var firstContent))
if (ContentDispositionHeaderValue.TryParse(firstSection.ContentDisposition, out var firstContent))
{
if(HasFileContentDisposition(firstContent))
if (HasFileContentDisposition(firstContent))
{
// Old style with just data
var fileName = HeaderUtilities.RemoveQuotes(firstContent.FileName).ToString();
using(firstSection.Body)
using (firstSection.Body)
{
await callback(firstSection.Body, fileName, null);
}
}
else if(HasKeyDisposition(firstContent))
else if (HasKeyDisposition(firstContent))
{
// New style with key, then data
string key = null;
using(var sr = new StreamReader(firstSection.Body))
using (var sr = new StreamReader(firstSection.Body))
{
key = await sr.ReadToEndAsync();
}
var secondSection = await reader.ReadNextSectionAsync();
if(secondSection != null)
if (secondSection != null)
{
if(ContentDispositionHeaderValue.TryParse(secondSection.ContentDisposition,
if (ContentDispositionHeaderValue.TryParse(secondSection.ContentDisposition,
out var secondContent) && HasFileContentDisposition(secondContent))
{
var fileName = HeaderUtilities.RemoveQuotes(secondContent.FileName).ToString();
using(secondSection.Body)
using (secondSection.Body)
{
await callback(secondSection.Body, fileName, key);
}
@@ -67,12 +67,12 @@ namespace Bit.Api.Utilities
private static string GetBoundary(MediaTypeHeaderValue contentType, int lengthLimit)
{
var boundary = HeaderUtilities.RemoveQuotes(contentType.Boundary);
if(StringSegment.IsNullOrEmpty(boundary))
if (StringSegment.IsNullOrEmpty(boundary))
{
throw new InvalidDataException("Missing content-type boundary.");
}
if(boundary.Length > lengthLimit)
if (boundary.Length > lengthLimit)
{
throw new InvalidDataException($"Multipart boundary length limit {lengthLimit} exceeded.");
}