improve FileManager performance when ShowFiles is disabled
This commit is contained in:
@ -446,6 +446,13 @@
|
||||
await OnUpload.InvokeAsync(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (AnonymizeUploadFilenames)
|
||||
{
|
||||
// it is not possible to determine the FileId of the uploaded file when filenames are anonymized
|
||||
await OnUpload.InvokeAsync(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
// set FileId to first file in upload collection
|
||||
var file = await FileService.GetFileAsync(int.Parse(folder), uploads[0].Split(":")[0]);
|
||||
@ -459,10 +466,14 @@
|
||||
await OnSelectFile.InvokeAsync(FileId);
|
||||
await OnUpload.InvokeAsync(FileId);
|
||||
}
|
||||
}
|
||||
if (ShowFiles)
|
||||
{
|
||||
await GetFiles();
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "File Upload Failed {Error}", ex.Message);
|
||||
@ -492,6 +503,7 @@
|
||||
private async Task DeleteFile()
|
||||
{
|
||||
_message = string.Empty;
|
||||
|
||||
try
|
||||
{
|
||||
await FileService.DeleteFileAsync(FileId);
|
||||
@ -504,6 +516,8 @@
|
||||
_messagetype = MessageType.Success;
|
||||
}
|
||||
|
||||
if (ShowFiles)
|
||||
{
|
||||
await GetFiles();
|
||||
FileId = -1;
|
||||
await SetImage();
|
||||
@ -512,6 +526,7 @@
|
||||
#pragma warning restore CS0618
|
||||
await OnSelectFile.InvokeAsync(FileId);
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
Reference in New Issue
Block a user