diff --git a/src/Api/Controllers/BorrowsController.cs b/src/Api/Controllers/BorrowsController.cs index 7f49b61e..ce16fece 100644 --- a/src/Api/Controllers/BorrowsController.cs +++ b/src/Api/Controllers/BorrowsController.cs @@ -7,6 +7,7 @@ using Application.Common.Models.Dtos; using Application.Common.Models.Dtos.Physical; using Application.Identity; +using Application.Loggings.Queries; using Infrastructure.Identity.Authorization; using Microsoft.AspNetCore.Mvc; diff --git a/src/Application/Entries/Commands/CreateEntry.cs b/src/Application/Entries/Commands/CreateEntry.cs index e5dcc8f8..1a9ddb4c 100644 --- a/src/Application/Entries/Commands/CreateEntry.cs +++ b/src/Application/Entries/Commands/CreateEntry.cs @@ -23,11 +23,12 @@ public Validator() RuleFor(x => x.Name) .NotEmpty().WithMessage("Entry's name is required.") + .Matches("^[\\p{L}A-Za-z_.\\s\\-0-9]*$").WithMessage("Invalid name format.") .MaximumLength(256).WithMessage("Name cannot exceed 256 characters."); - + RuleFor(x => x.Path) .NotEmpty().WithMessage("Entry's path is required.") - .Matches("^(/(?!/)[A-Za-z_.\\s\\-0-9]*)+(? x.Name) + .NotEmpty().WithMessage("Entry's name is required.") + .Matches("^[\\p{L}A-Za-z_.\\s\\-0-9]*$").WithMessage("Invalid name format.") .MaximumLength(256).WithMessage("Name cannot exceed 256 characters."); } } diff --git a/src/Application/Entries/Commands/DownloadDigitalFile.cs b/src/Application/Entries/Commands/DownloadDigitalFile.cs index ef020e9a..85048f97 100644 --- a/src/Application/Entries/Commands/DownloadDigitalFile.cs +++ b/src/Application/Entries/Commands/DownloadDigitalFile.cs @@ -80,7 +80,7 @@ public async Task Handle(Command request, CancellationToken cancellation { Content = content, FileType = fileType, - FileName = entry.Name, + FileName = $"{entry.Name}.{entry.File.FileExtension}", }; } } diff --git a/src/Application/Entries/Queries/GetAllEntriesPaginated.cs b/src/Application/Entries/Queries/GetAllEntriesPaginated.cs index 53dbdfb0..ef0cf431 100644 --- a/src/Application/Entries/Queries/GetAllEntriesPaginated.cs +++ b/src/Application/Entries/Queries/GetAllEntriesPaginated.cs @@ -20,7 +20,7 @@ public Validator() RuleFor(x => x.EntryPath) .NotEmpty().WithMessage("File's path is required.") - .Matches("^(/(?!/)[A-Za-z_.\\s\\-0-9]*)+(?