@page "/Settings/Tools/MissingArchives" @inject ArchiveService ArchiveService @inject IMessageService MessageService @inject ILogger Logger @attribute [Authorize(Roles = RoleService.AdministratorRoleName)]

These archives are missing their backing file in the "Upload" directory of your server. This may result in broken downloads for clients. To fix, either upload a new file or delete the offending archive.

@context.CreatedBy?.UserName
@code { ICollection Archives; bool Loading = true; ArchiveUploader Uploader; protected override async Task OnInitializedAsync() { await LoadData(); } async Task LoadData() { Loading = true; Archives = new List(); foreach (var archive in await ArchiveService.GetAsync()) { var archivePath = await ArchiveService.GetArchiveFileLocationAsync(archive); var exists = await ArchiveService.FileExistsAsync(archive.Id); if (!exists) Archives.Add(archive); else if (new FileInfo(archivePath).Length == 0) Archives.Add(archive); } Loading = false; } async Task Upload(Archive archive) { var archiveFilePath = await ArchiveService.GetArchiveFileLocationAsync(archive); if (await ArchiveService.FileExistsAsync(archive.Id)) File.Delete(archiveFilePath); File.Create(archiveFilePath).Close(); await Uploader.Open(archive.Id); } async Task Delete(Archive archive) { try { await ArchiveService.DeleteAsync(archive); await LoadData(); await MessageService.SuccessAsync("Archive deleted!"); } catch (Exception ex) { MessageService.Error("Archive could not be deleted."); Logger.LogError(ex, "Archive could not be deleted."); } } }