Skip to content

Commit

Permalink
Fix more warnings (#793)
Browse files Browse the repository at this point in the history
* Warning fixes

* More warnings

* Format

* Fix regex

* Move string to extension from uri

* More fixes

* More stuff

* Format

* No extra files in test projects

* Possible fix for build failure

* increases the http timeout

* uses 'Dispose' instead of 'using'

---------

Co-authored-by: Ersan <ersan.bozduman@gmail.com>
  • Loading branch information
martijn00 and ebozduman committed Jun 14, 2023
1 parent 26fb848 commit db93895
Show file tree
Hide file tree
Showing 61 changed files with 957 additions and 746 deletions.
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"jetbrains.resharper.globaltools": {
"version": "2023.1.1",
"version": "2023.1.2",
"commands": [
"jb"
]
Expand Down
4 changes: 2 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
</PropertyGroup>

<ItemGroup>
<ItemGroup Condition=" '$(IsTestProject)' != 'true'">
<None Include="$(MSBuildThisFileDirectory)\LICENSE" Pack="true" PackagePath="\" />
<None Include="$(MSBuildThisFileDirectory)\icon.png" Pack="true" PackagePath="\" />
<None Include="$(MSBuildThisFileDirectory)\readme.md" Pack="true" PackagePath="\" />
Expand All @@ -78,7 +78,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Meziantou.Analyzer" Version="2.0.48">
<PackageReference Include="Meziantou.Analyzer" Version="2.0.60">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
Expand Down
7 changes: 4 additions & 3 deletions Minio.Examples/Cases/CopyObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@ internal static class CopyObject
{
Console.WriteLine("Running example for API: CopyObjectAsync");
var metaData = new Dictionary<string, string>
{
{ "Test-Metadata", "Test Test" }
};
(StringComparer.Ordinal)
{
{ "Test-Metadata", "Test Test" }
};
// Optionally pass copy conditions
var cpSrcArgs = new CopySourceObjectArgs()
.WithBucket(fromBucketName)
Expand Down
9 changes: 5 additions & 4 deletions Minio.Examples/Cases/CopyObjectMetadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@ internal static class CopyObjectMetadata

// set custom metadata
var metadata = new Dictionary<string, string>
{
{ "Content-Type", "application/css" },
{ "Mynewkey", "my-new-value" }
};
(StringComparer.Ordinal)
{
{ "Content-Type", "application/css" },
{ "Mynewkey", "my-new-value" }
};

var copySourceObjectArgs = new CopySourceObjectArgs()
.WithBucket(fromBucketName)
Expand Down
7 changes: 4 additions & 3 deletions Minio.Examples/Cases/CopyObjectReplaceTags.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ internal static class CopyObjectReplaceTags
{
Console.WriteLine("Running example for API: CopyObjectAsync with Tags");
var tags = new Dictionary<string, string>
{
{ "Test-TagKey", "Test-TagValue" }
};
(StringComparer.Ordinal)
{
{ "Test-TagKey", "Test-TagValue" }
};
var tagObj = Tagging.GetObjectTags(tags);
var cpSrcArgs = new CopySourceObjectArgs()
.WithBucket(fromBucketName)
Expand Down
3 changes: 2 additions & 1 deletion Minio.Examples/Cases/PresignedGetObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ public static class PresignedGetObject
{
if (client is null) throw new ArgumentNullException(nameof(client));

var reqParams = new Dictionary<string, string> { { "response-content-type", "application/json" } };
var reqParams = new Dictionary<string, string>(StringComparer.Ordinal)
{ { "response-content-type", "application/json" } };
var args = new PresignedGetObjectArgs()
.WithBucket(bucketName)
.WithObject(objectName)
Expand Down
2 changes: 1 addition & 1 deletion Minio.Examples/Cases/PresignedPostPolicy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public static class PresignedPostPolicy

var tuple = await client.PresignedPostPolicyAsync(form).ConfigureAwait(false);
var curlCommand = "curl -k --insecure -X POST";
foreach (var pair in tuple.Item2) curlCommand = curlCommand + $" -F {pair.Key}={pair.Value}";
foreach (var pair in tuple.Item2) curlCommand += $" -F {pair.Key}={pair.Value}";
curlCommand = curlCommand + " -F file=@/etc/issue " + tuple.Item1 + bucketName + "/";
}
}
7 changes: 4 additions & 3 deletions Minio.Examples/Cases/PutObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@ internal static class PutObject

var fileInfo = new FileInfo(fileName);
var metaData = new Dictionary<string, string>
{
{ "Test-Metadata", "Test Test" }
};
(StringComparer.Ordinal)
{
{ "Test-Metadata", "Test Test" }
};
var args = new PutObjectArgs()
.WithBucket(bucketName)
.WithObject(objectName)
Expand Down
7 changes: 4 additions & 3 deletions Minio.Examples/Cases/PutObjectWithTags.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ internal static class PutObjectWithTags
{
Console.WriteLine("Running example for API: PutObjectAsync with Tags");
var tags = new Dictionary<string, string>
{
{ "Test-TagKey", "Test-TagValue" }
};
(StringComparer.Ordinal)
{
{ "Test-TagKey", "Test-TagValue" }
};
var args = new PutObjectArgs()
.WithBucket(bucketName)
.WithObject(objectName)
Expand Down
5 changes: 3 additions & 2 deletions Minio.Examples/Cases/RetryPolicyObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ public static PolicyBuilder<ResponseResult> CreatePolicyBuilder()
{
return Policy<ResponseResult>
.Handle<ConnectionException>()
.Or<InternalClientException>(ex => ex.Message.StartsWith("Unsuccessful response from server"));
.Or<InternalClientException>(ex =>
ex.Message.StartsWith("Unsuccessful response from server", StringComparison.InvariantCulture));
}

public static AsyncPolicy<ResponseResult> GetDefaultRetryPolicy()
Expand All @@ -62,7 +63,7 @@ public static AsyncPolicy<ResponseResult> GetDefaultRetryPolicy()
i => CalcBackoff(i, retryInterval, maxRetryInterval));
}

public static RetryPolicyHandlingDelegate AsRetryDelegate(this AsyncPolicy<ResponseResult> policy)
public static RetryPolicyHandler AsRetryDelegate(this AsyncPolicy<ResponseResult> policy)
{
return policy is null
? null
Expand Down
3 changes: 2 additions & 1 deletion Minio.Examples/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ await CopyObjectMetadata.Run(minioClient, bucketName, objectName, destBucketName
var sses3 = new SSES3();

// Uncomment to specify SSE-KMS encryption option
var sseKms = new SSEKMS("kms-key", new Dictionary<string, string> { { "kms-context", "somevalue" } });
var sseKms = new SSEKMS("kms-key",
new Dictionary<string, string>(StringComparer.Ordinal) { { "kms-context", "somevalue" } });

// Upload encrypted object
var putFileName1 = CreateFile(1 * UNIT_MB);
Expand Down
Loading

0 comments on commit db93895

Please sign in to comment.