~ruther/NosSmooth

2108f59ea77b7e9500037165990f8767de5c3ddd — František Boháček 3 years ago 18df52d
feat(data): return correct message with file not found in archive
1 files changed, 4 insertions(+), 3 deletions(-)

M Data/NosSmooth.Data.NOSFiles/Files/FileArchive.cs
M Data/NosSmooth.Data.NOSFiles/Files/FileArchive.cs => Data/NosSmooth.Data.NOSFiles/Files/FileArchive.cs +4 -3
@@ 19,12 19,13 @@ public record FileArchive(IReadOnlyList<RawFile> Files)
    /// </summary>
    /// <param name="name">The name of the file.</param>
    /// <returns>A file or an error.</returns>
    public Result<RawFile> Search(string name)
    public Result<RawFile> FindFile(string name)
    {
        var foundFile = Files.OfType<RawFile?>().FirstOrDefault(x => Path.GetFileName((RawFile)x.Path) == name, null);
        var foundFile = Files.OfType<RawFile?>().FirstOrDefault
            (x => Path.GetFileName(((RawFile)x!).Path) == name, null);
        if (foundFile is null)
        {
            return new NotFoundError();
            return new NotFoundError($"Could not find file {name} in archive.");
        }

        return (RawFile)foundFile;

Do not follow this link