🐛 Bug fixes

This commit is contained in:
2025-07-19 02:49:39 +08:00
parent 57f85ec341
commit e0e1eb76cd
12 changed files with 37 additions and 16 deletions

View File

@@ -50,7 +50,7 @@ public class FileService(
return file;
}
public async Task<List<CloudFile>> GetFilesAsync(List<string> fileIds)
{
var cachedFiles = new Dictionary<string, CloudFile>();
@@ -146,7 +146,11 @@ public class FileService(
{
case "image":
var blurhash =
BlurHashSharp.SkiaSharp.BlurHashEncoder.Encode(xComponent: 3, yComponent: 3, filename: ogFilePath);
BlurHashSharp.SkiaSharp.BlurHashEncoder.Encode(
xComponent: 3,
yComponent: 3,
filename: ogFilePath
);
// Rewind stream
stream.Position = 0;
@@ -160,7 +164,7 @@ public class FileService(
// Try to get orientation from exif data
var orientation = 1;
var meta = new Dictionary<string, object>
var meta = new Dictionary<string, object?>
{
["blur"] = blurhash,
["format"] = format,

View File

@@ -12,7 +12,7 @@ namespace DysonNetwork.Drive.Storage;
public abstract class TusService
{
public static DefaultTusConfiguration BuildConfiguration(ITusStore store) => new()
public static DefaultTusConfiguration BuildConfiguration(ITusStore store, IConfiguration configuration) => new()
{
Store = store,
Events = new Events
@@ -73,6 +73,13 @@ public abstract class TusService
// Dispose the stream after all processing is complete
await fileStream.DisposeAsync();
},
OnCreateCompleteAsync = eventContext =>
{
var gatewayUrl = configuration["GatewayUrl"];
if (gatewayUrl is not null)
eventContext.SetUploadUrl(new Uri(gatewayUrl + "/drive/tus/" + eventContext.FileId));
return Task.CompletedTask;
}
}
};