From c052f17623f88fb061ee5f5f47f23be60ce1b808 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Mon, 12 Jan 2026 00:04:29 +0800 Subject: [PATCH] :bug: Fix dozens of issues in new drive system --- DysonNetwork.Drive/Index/FileIndexController.cs | 1 + DysonNetwork.Drive/Index/FileIndexService.cs | 2 ++ DysonNetwork.Drive/Startup/BroadcastEventHandler.cs | 5 ++++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/DysonNetwork.Drive/Index/FileIndexController.cs b/DysonNetwork.Drive/Index/FileIndexController.cs index d8758c09..50fe0ecb 100644 --- a/DysonNetwork.Drive/Index/FileIndexController.cs +++ b/DysonNetwork.Drive/Index/FileIndexController.cs @@ -546,6 +546,7 @@ public class FileIndexController( var fileIndexes = await db.FileIndexes .Where(fi => fi.AccountId == accountId) .Include(fi => fi.File) + .ThenInclude(f => f.Object) .Where(fi => (string.IsNullOrEmpty(path) || fi.Path == FileIndexService.NormalizePath(path)) && (fi.File.Name.ToLower().Contains(searchTerm) || diff --git a/DysonNetwork.Drive/Index/FileIndexService.cs b/DysonNetwork.Drive/Index/FileIndexService.cs index 9d8d7d8a..bf5bc7ef 100644 --- a/DysonNetwork.Drive/Index/FileIndexService.cs +++ b/DysonNetwork.Drive/Index/FileIndexService.cs @@ -141,6 +141,7 @@ public class FileIndexService(AppDatabase db) return await db.FileIndexes .Where(fi => fi.AccountId == accountId && fi.Path == normalizedPath) .Include(fi => fi.File) + .ThenInclude(f => f.Object) .ToListAsync(); } @@ -154,6 +155,7 @@ public class FileIndexService(AppDatabase db) return await db.FileIndexes .Where(fi => fi.FileId == fileId) .Include(fi => fi.File) + .ThenInclude(f => f.Object) .ToListAsync(); } diff --git a/DysonNetwork.Drive/Startup/BroadcastEventHandler.cs b/DysonNetwork.Drive/Startup/BroadcastEventHandler.cs index 05c9b898..69993918 100644 --- a/DysonNetwork.Drive/Startup/BroadcastEventHandler.cs +++ b/DysonNetwork.Drive/Startup/BroadcastEventHandler.cs @@ -156,7 +156,10 @@ public class BroadcastEventHandler( logger.LogInformation("Processing file {FileId} in background...", fileId); - var fileToUpdate = await scopedDb.Files.AsNoTracking().FirstAsync(f => f.Id == fileId); + var fileToUpdate = await scopedDb.Files + .AsNoTracking() + .Include(f => f.Object) + .FirstAsync(f => f.Id == fileId); // Find the upload task associated with this file var baseTask = await scopedDb.Tasks