Fix all nullable reference warnings for clean build

 Resolved all CS8601, CS8603, and CS8604 warnings:
  • Fixed AdvancedMetadataHandler nullable assignments
  • Fixed MultipartUploadManager return value warning
  • Fixed cmdlet parameter warnings in GetMinIOBucket and GetMinIOObject
  • Fixed ZipArchiveBuilder substring warning

 Clean build achieved:
  • Zero compilation errors
  • Zero warnings
  • Enterprise-grade code quality
  • Full .NET Standard 2.0 compatibility

All comprehensive MinIO features now compile cleanly with no warnings.
This commit is contained in:
PSMinIO Developer
2025-07-11 22:14:57 -04:00
parent 089f1ed951
commit dfe3306a14
6 changed files with 18 additions and 18 deletions
+1 -1
View File
@@ -64,7 +64,7 @@ namespace PSMinIO.Cmdlets
{
var wildcardPattern = new WildcardPattern(BucketName, WildcardOptions.IgnoreCase);
buckets = buckets.Where(b => b.Name != null && wildcardPattern.IsMatch(b.Name)).ToList();
WriteVerboseMessage("Filtered to {0} buckets matching pattern '{1}'", buckets.Count, BucketName!);
WriteVerboseMessage("Filtered to {0} buckets matching pattern '{1}'", buckets.Count, BucketName);
}
// Enhance bucket information if requested
+1 -1
View File
@@ -108,7 +108,7 @@ namespace PSMinIO.Cmdlets
{
var wildcardPattern = new WildcardPattern(Name, WildcardOptions.IgnoreCase);
objects = objects.Where(o => o.Name != null && wildcardPattern.IsMatch(o.Name)).ToList();
WriteVerboseMessage("Filtered to {0} objects matching pattern '{1}'", objects.Count, Name!);
WriteVerboseMessage("Filtered to {0} objects matching pattern '{1}'", objects.Count, Name);
}
// Apply directory filters
+1 -1
View File
@@ -131,7 +131,7 @@ namespace PSMinIO.Cmdlets
if (!string.IsNullOrEmpty(ResumeUploadId))
{
WriteVerboseMessage("Resuming upload with ID: {0}", ResumeUploadId);
WriteVerboseMessage("Resuming upload with ID: {0}", ResumeUploadId!);
if (CompletedParts != null && CompletedParts.Length > 0)
{
WriteVerboseMessage("Found {0} completed parts", CompletedParts.Length);
+13 -13
View File
@@ -24,31 +24,31 @@ namespace PSMinIO.Core.S3
// Content-Type
if (!string.IsNullOrEmpty(metadata.ContentType))
{
headers["Content-Type"] = metadata.ContentType;
headers["Content-Type"] = metadata.ContentType!;
}
// Content-Encoding
if (!string.IsNullOrEmpty(metadata.ContentEncoding))
{
headers["Content-Encoding"] = metadata.ContentEncoding;
headers["Content-Encoding"] = metadata.ContentEncoding!;
}
// Content-Language
if (!string.IsNullOrEmpty(metadata.ContentLanguage))
{
headers["Content-Language"] = metadata.ContentLanguage;
headers["Content-Language"] = metadata.ContentLanguage!;
}
// Content-Disposition
if (!string.IsNullOrEmpty(metadata.ContentDisposition))
{
headers["Content-Disposition"] = metadata.ContentDisposition;
headers["Content-Disposition"] = metadata.ContentDisposition!;
}
// Cache-Control
if (!string.IsNullOrEmpty(metadata.CacheControl))
{
headers["Cache-Control"] = metadata.CacheControl;
headers["Cache-Control"] = metadata.CacheControl!;
}
// Expires
@@ -60,49 +60,49 @@ namespace PSMinIO.Core.S3
// Server-Side Encryption
if (!string.IsNullOrEmpty(metadata.ServerSideEncryption))
{
headers["x-amz-server-side-encryption"] = metadata.ServerSideEncryption;
headers["x-amz-server-side-encryption"] = metadata.ServerSideEncryption!;
}
// SSE-KMS Key ID
if (!string.IsNullOrEmpty(metadata.SSEKMSKeyId))
{
headers["x-amz-server-side-encryption-aws-kms-key-id"] = metadata.SSEKMSKeyId;
headers["x-amz-server-side-encryption-aws-kms-key-id"] = metadata.SSEKMSKeyId!;
}
// SSE-C Algorithm
if (!string.IsNullOrEmpty(metadata.SSECustomerAlgorithm))
{
headers["x-amz-server-side-encryption-customer-algorithm"] = metadata.SSECustomerAlgorithm;
headers["x-amz-server-side-encryption-customer-algorithm"] = metadata.SSECustomerAlgorithm!;
}
// SSE-C Key
if (!string.IsNullOrEmpty(metadata.SSECustomerKey))
{
headers["x-amz-server-side-encryption-customer-key"] = metadata.SSECustomerKey;
headers["x-amz-server-side-encryption-customer-key"] = metadata.SSECustomerKey!;
}
// SSE-C Key MD5
if (!string.IsNullOrEmpty(metadata.SSECustomerKeyMD5))
{
headers["x-amz-server-side-encryption-customer-key-MD5"] = metadata.SSECustomerKeyMD5;
headers["x-amz-server-side-encryption-customer-key-MD5"] = metadata.SSECustomerKeyMD5!;
}
// Storage Class
if (!string.IsNullOrEmpty(metadata.StorageClass))
{
headers["x-amz-storage-class"] = metadata.StorageClass;
headers["x-amz-storage-class"] = metadata.StorageClass!;
}
// Website Redirect Location
if (!string.IsNullOrEmpty(metadata.WebsiteRedirectLocation))
{
headers["x-amz-website-redirect-location"] = metadata.WebsiteRedirectLocation;
headers["x-amz-website-redirect-location"] = metadata.WebsiteRedirectLocation!;
}
// Object Lock Mode
if (!string.IsNullOrEmpty(metadata.ObjectLockMode))
{
headers["x-amz-object-lock-mode"] = metadata.ObjectLockMode;
headers["x-amz-object-lock-mode"] = metadata.ObjectLockMode!;
}
// Object Lock Retain Until Date
+1 -1
View File
@@ -208,7 +208,7 @@ namespace PSMinIO.Core.S3
throw new InvalidOperationException("Failed to initiate multipart upload - no upload ID returned");
}
return uploadId;
return uploadId!;
}
/// <summary>
+1 -1
View File
@@ -194,7 +194,7 @@ namespace PSMinIO.Utils
var fullPath = fileInfo.FullName;
if (fullPath.StartsWith(basePath, StringComparison.OrdinalIgnoreCase))
{
var relativePath = fullPath.Substring(basePath!.Length).TrimStart('\\', '/');
var relativePath = fullPath.Substring(basePath.Length).TrimStart('\\', '/');
return relativePath.Replace('\\', '/'); // Use forward slashes for zip entries
}