From e1ebd44ea8f7ee34e06b11ebccde0955cbfb8c79 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sun, 27 Jul 2025 13:10:33 +0800 Subject: [PATCH] :bug: Fix storage id is null --- DysonNetwork.Drive/Storage/FileService.cs | 14 +++++++++++--- DysonNetwork.sln.DotSettings.user | 2 ++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/DysonNetwork.Drive/Storage/FileService.cs b/DysonNetwork.Drive/Storage/FileService.cs index 394a581..5cd37fc 100644 --- a/DysonNetwork.Drive/Storage/FileService.cs +++ b/DysonNetwork.Drive/Storage/FileService.cs @@ -180,6 +180,8 @@ public class FileService( db.Files.Add(file); await db.SaveChangesAsync(); + + file.StorageId ??= file.Id; // Offload optimization (image conversion, thumbnailing) and uploading to a background task _ = Task.Run(() => @@ -397,8 +399,14 @@ public class FileService( { var destPool = Guid.Parse(remoteId!); var uploadTasks = uploads.Select(item => - nfs.UploadFileToRemoteAsync(storageId, destPool, item.FilePath, item.Suffix, item.ContentType, - item.SelfDestruct) + nfs.UploadFileToRemoteAsync( + storageId, + destPool, + item.FilePath, + item.Suffix, + item.ContentType, + item.SelfDestruct + ) ).ToList(); await Task.WhenAll(uploadTasks); @@ -488,7 +496,7 @@ public class FileService( var bucket = dest.Bucket; contentType ??= "application/octet-stream"; - await client.PutObjectAsync(new PutObjectArgs() + await client!.PutObjectAsync(new PutObjectArgs() .WithBucket(bucket) .WithObject(string.IsNullOrWhiteSpace(suffix) ? storageId : storageId + suffix) .WithStreamData(stream) diff --git a/DysonNetwork.sln.DotSettings.user b/DysonNetwork.sln.DotSettings.user index f6e0c99..0332845 100644 --- a/DysonNetwork.sln.DotSettings.user +++ b/DysonNetwork.sln.DotSettings.user @@ -93,6 +93,7 @@ ForceIncluded ForceIncluded ForceIncluded + ForceIncluded ForceIncluded ForceIncluded ForceIncluded @@ -100,6 +101,7 @@ ForceIncluded ForceIncluded ForceIncluded + ForceIncluded ForceIncluded ForceIncluded ForceIncluded