Skip to content

Commit

Permalink
.Net4.x workaround for unhandled special chars (#776)
Browse files Browse the repository at this point in the history
* .Net4.x workaround for unhandled special chars

* adds the forgotten comments for the workaround

* lint changes
  • Loading branch information
ebozduman committed Apr 27, 2023
1 parent 66cef4f commit 4276f66
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Minio.Functional.Tests/FunctionalTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,11 @@ public static string GetRandomObjectName(int length = 5)
{
// Server side does not allow the following characters in object names
// '-', '_', '.', '/', '*'
#if NET6_0_OR_GREATER
var characters = "abcd+%$#@&{}[]()";
#else
var characters = "abcdefgh+%$#@&";
#endif
var result = new StringBuilder(length);

for (var i = 0; i < length; i++) result.Append(characters[rnd.Next(characters.Length)]);
Expand Down Expand Up @@ -4818,6 +4822,7 @@ internal static async Task GetObject_3_OffsetLength_Tests(MinioClient minio)
}
}
}

#if NET6_0_OR_GREATER
internal static async Task GetObject_AsyncCallback_Test1(MinioClient minio)
{
Expand Down Expand Up @@ -4874,13 +4879,14 @@ internal static async Task GetObject_AsyncCallback_Test1(MinioClient minio)
file_read_size = writtenInfo.Length;
Assert.AreEqual(size, file_read_size);

new MintLogger("GetObject_LargeFile_Test0", getObjectSignature,
new MintLogger("GetObject_AsyncCallback_Test1", getObjectSignature,
"Tests whether GetObject as stream works",
TestStatus.PASS, DateTime.Now - startTime, args: args).Log();
}
catch (Exception ex)
{
new MintLogger("GetObject_LargeFile_Test0", getObjectSignature, "Tests whether GetObject as stream works",
new MintLogger("GetObject_AsyncCallback_Test1", getObjectSignature,
"Tests whether GetObject as stream works",
TestStatus.FAIL, DateTime.Now - startTime, ex.Message, ex.ToString(), args: args).Log();
throw;
}
Expand All @@ -4894,6 +4900,7 @@ internal static async Task GetObject_AsyncCallback_Test1(MinioClient minio)
}
}
#endif

internal static async Task FGetObject_Test1(MinioClient minio)
{
var startTime = DateTime.Now;
Expand Down
4 changes: 4 additions & 0 deletions Minio.Functional.Tests/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ public static async Task Main(string[] args)
// Set HTTP Tracing Off
// minioClient.SetTraceOff();

// Print Minio version in use
// var version = typeof(MinioClient).Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion;
// Console.WriteLine($"\n Minio package version is {version.Substring(0, version.IndexOf('+'))}\n");

var runMode = Environment.GetEnvironmentVariable("MINT_MODE");

if (!string.IsNullOrEmpty(runMode) && string.Equals(runMode, "core", StringComparison.OrdinalIgnoreCase))
Expand Down

0 comments on commit 4276f66

Please sign in to comment.