Jezda.Common.Files
1.0.35
dotnet add package Jezda.Common.Files --version 1.0.35
NuGet\Install-Package Jezda.Common.Files -Version 1.0.35
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Jezda.Common.Files" Version="1.0.35" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Jezda.Common.Files" Version="1.0.35" />
<PackageReference Include="Jezda.Common.Files" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Jezda.Common.Files --version 1.0.35
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Jezda.Common.Files, 1.0.35"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Jezda.Common.Files@1.0.35
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Jezda.Common.Files&version=1.0.35
#tool nuget:?package=Jezda.Common.Files&version=1.0.35
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Jezda.Common.Files
Centralizovana biblioteka za validaciju fajlova u mikroservisima Jezda Solutions.
Ključne funkcionalnosti
- Detekcija MIME tipa na osnovu sadržaja (magic numbers).
- Validacija veličine, ekstenzije, MIME tipa i naziva fajla.
- Opciono: heuristike bezbednosti (zip bomb, izvršni fajlovi, dimenzije slika).
- Opciono: SHA-256 hashing sadržaja.
- Jednostavan API (
IFormFileiStream). - DI integracija:
services.AddFileValidation().
Brzi start
// Program.cs
builder.Services.AddFileValidation();
// Endpoint
var overrides = new FileValidationOverrides
{
MaxSizeBytes = 10 * 1024 * 1024,
AllowedExtensions = new[] { "png", "jpg", "jpeg", "pdf" },
AllowedMimeTypes = new[] { "image/png", "image/jpeg", "application/pdf" }
};
var result = await fileValidator.ValidateAsync(req.File, overrides, ct);
if (!result.IsValid)
{
return Results.BadRequest(result.Errors.Select(e => new { e.Code, e.Message }));
}
Konfiguracija (primer)
{
"FileValidation": {
"MaxSizeBytes": 10485760,
"AllowedMimeTypes": ["image/png", "image/jpeg", "application/pdf"],
"AllowedExtensions": ["png", "jpg", "jpeg", "pdf"],
"BlockedExtensions": ["exe", "dll"],
"BlockExecutables": true,
"EnableZipSafetyChecks": true,
"ZipMaxDepth": 5,
"ZipMaxEntries": 1000,
"ZipMaxCompressionRatio": 200.0,
"EnableImageDimensionChecks": false,
"EnableHashing": true,
"EnableMalwareHeuristics": true
}
}
Napomene
- Stream se koristi pažljivo (seek/reset) bez nepotrebnog učitavanja u memoriju.
- MIME detekcija primarno gleda sadržaj; ekstenzije su sekundarni signal.
- Za AV integraciju, registrujte sopstveni
IFileScannerpreko DI.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net9.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.