diff --git a/src/isn.abst/Constants.cs b/src/isn.abst/Constants.cs index 215d61b..cad6de4 100644 --- a/src/isn.abst/Constants.cs +++ b/src/isn.abst/Constants.cs @@ -2,8 +2,8 @@ namespace isn.abst { public static class Constants { - public const string PaquetFileEstension = "nupkg"; - public const string SpecFileEstension = "nuspec"; + public const string PacketFileExtension = "nupkg"; + public const string SpecFileExtension = "nuspec"; public const string ApiVersionPrefix = "/v3"; } } \ No newline at end of file diff --git a/src/isnd/Controllers/Packages/PackagesController.GetPackage.cs b/src/isnd/Controllers/Packages/PackagesController.GetPackage.cs index 194277b..2c67ceb 100644 --- a/src/isnd/Controllers/Packages/PackagesController.GetPackage.cs +++ b/src/isnd/Controllers/Packages/PackagesController.GetPackage.cs @@ -12,16 +12,16 @@ namespace isnd.Controllers { // Web get the paquet [HttpGet("~" + Constants.ApiVersionPrefix + ApiConfig.Nuget + "/{id}/{lower}/{idf}-{lowerf}." - + Constants.PaquetFileEstension)] + + Constants.PacketFileExtension)] [HttpGet("~" + Constants.ApiVersionPrefix + ApiConfig.Content + "/{id}/{lower}/{idf}-{lowerf}." - + Constants.PaquetFileEstension)] + + Constants.PacketFileExtension)] public IActionResult GetPackage( [FromRoute][SafeName][Required] string id, [FromRoute][SafeName][Required] string lower, [FromRoute] string idf, [FromRoute] string lowerf) { var pkgpath = Path.Combine(isndSettings.PackagesRootDir, - id, lower, $"{id}-{lower}." + Constants.PaquetFileEstension + id, lower, $"{id}-{lower}." + Constants.PacketFileExtension ); FileInfo pkgfi = new FileInfo(pkgpath); @@ -35,7 +35,7 @@ namespace isnd.Controllers // Web get spec [HttpGet("~" + Constants.ApiVersionPrefix + ApiConfig.Nuspec + "/{id}/{lower}/{idf}-{lowerf}." - + Constants.SpecFileEstension)] + + Constants.SpecFileExtension)] public IActionResult GetNuspec( [FromRoute][SafeName][Required] string id, [FromRoute][SafeName][Required] string lower, @@ -43,7 +43,7 @@ namespace isnd.Controllers [FromRoute][SafeName][Required] string lowerf) { var pkgpath = Path.Combine(isndSettings.PackagesRootDir, - id, lower, $"{id}." + Constants.SpecFileEstension); + id, lower, $"{id}." + Constants.SpecFileExtension); FileInfo pkgfi = new FileInfo(pkgpath); if (!pkgfi.Exists) diff --git a/src/isnd/Controllers/Packages/PackagesController.Put.cs b/src/isnd/Controllers/Packages/PackagesController.Put.cs index cbf26a7..8b4a570 100644 --- a/src/isnd/Controllers/Packages/PackagesController.Put.cs +++ b/src/isnd/Controllers/Packages/PackagesController.Put.cs @@ -55,7 +55,7 @@ namespace isnd.Controllers { string initpath = Path.Combine(Environment.GetEnvironmentVariable("TEMP") ?? Environment.GetEnvironmentVariable("TMP") ?? "/tmp", - $"isn-{Guid.NewGuid()}."+Constants.PaquetFileEstension); + $"isn-{Guid.NewGuid()}."+Constants.PacketFileExtension); using (FileStream fw = new FileStream(initpath, FileMode.Create)) { @@ -66,8 +66,8 @@ namespace isnd.Controllers { var archive = new ZipArchive(fw); - var spec = archive.Entries.FirstOrDefault(e => e.FullName.EndsWith("." + Constants.SpecFileEstension)); - if (spec == null) return BadRequest(new { error = "no " + Constants.SpecFileEstension + " from archive" }); + var spec = archive.Entries.FirstOrDefault(e => e.FullName.EndsWith("." + Constants.SpecFileExtension)); + if (spec == null) return BadRequest(new { error = "no " + Constants.SpecFileExtension + " from archive" }); string pkgpath; NuGetVersion version; string pkgid; @@ -85,7 +85,7 @@ namespace isnd.Controllers string pkgidpath = Path.Combine(isndSettings.PackagesRootDir, pkgid); pkgpath = Path.Combine(pkgidpath, version.ToFullString()); - string name = $"{pkgid}-{version}."+Constants.PaquetFileEstension; + string name = $"{pkgid}-{version}."+Constants.PacketFileExtension; fullpath = Path.Combine(pkgpath, name); var destpkgiddir = new DirectoryInfo(pkgidpath); @@ -201,7 +201,7 @@ namespace isnd.Controllers } } } - string nuspecfullpath = Path.Combine(pkgpath, pkgid + "." + Constants.SpecFileEstension); + string nuspecfullpath = Path.Combine(pkgpath, pkgid + "." + Constants.SpecFileExtension); FileInfo nfpi = new(nuspecfullpath); if (nfpi.Exists) diff --git a/src/isnd/Data/Catalog/RegistratioinLeave.cs b/src/isnd/Data/Catalog/RegistratioinLeave.cs index f617059..2fc7169 100644 --- a/src/isnd/Data/Catalog/RegistratioinLeave.cs +++ b/src/isnd/Data/Catalog/RegistratioinLeave.cs @@ -17,7 +17,7 @@ namespace isnd.Data.Catalog this.registration = apiBase + ApiConfig.Registration + "/" + pkgId + "/" + fullVersionString + ".json"; Id = registration; this.PackageContent = apiBase + ApiConfig.Nuget + "/" + pkgId + "/" + fullVersionString - + "/" + pkgId + "-" + fullVersionString + "." + Constants.PaquetFileEstension; + + "/" + pkgId + "-" + fullVersionString + "." + Constants.PacketFileExtension; Entry = entry; } diff --git a/src/isnd/Data/Packages/PackageVersion.cs b/src/isnd/Data/Packages/PackageVersion.cs index 5203bdc..384b4db 100644 --- a/src/isnd/Data/Packages/PackageVersion.cs +++ b/src/isnd/Data/Packages/PackageVersion.cs @@ -60,9 +60,9 @@ namespace isnd.Data public virtual Commit LatestCommit { get; set; } public string NugetLink => $"{ApiConfig.Nuget}/{PackageId}/{FullString}/{PackageId}-{FullString}." - + Constants.PaquetFileEstension; + + Constants.PacketFileExtension; public string NuspecLink => $"{ApiConfig.Nuspec}/{PackageId}/{FullString}/{PackageId}-{FullString}." - + Constants.SpecFileEstension; + + Constants.SpecFileExtension; public string SementicVersionString { get => $"{Major}.{Minor}.{Patch}"; } public NuGetVersion NugetVersion { get => new NuGetVersion(FullString); } diff --git a/src/isnd/Services/EmailSender.cs b/src/isnd/Services/EmailSender.cs index 31b85e7..5d27e4c 100644 --- a/src/isnd/Services/EmailSender.cs +++ b/src/isnd/Services/EmailSender.cs @@ -15,13 +15,13 @@ namespace isnd.Services public class EmailSender : IEmailSender, IMailer { public EmailSender(IOptions smtpSettings, - IHostingEnvironment env) + IWebHostEnvironment env) { Options = smtpSettings.Value; Env = env; } public SmtpSettings Options { get; } //set only via Secret Manager - public IHostingEnvironment Env { get; } + public IWebHostEnvironment Env { get; } public Task SendEmailAsync(string email, string subject, string message) { return Execute(Options.SenderName, subject, message, email); @@ -32,7 +32,7 @@ namespace isnd.Services await SendMailAsync(name, email, subject, message); } - public async Task SendMailAsync(string name, string email, string subjet, string body) + public async Task SendMailAsync(string name, string email, string subject, string body) { try { var message = new MimeMessage(); diff --git a/test/isn.tests/PushTest.cs b/test/isn.tests/PushTest.cs index 0f7b947..7e910b4 100644 --- a/test/isn.tests/PushTest.cs +++ b/test/isn.tests/PushTest.cs @@ -1,7 +1,4 @@ using System; -using System.Data; -using System.IO; -using System.Xml; using System.Net.Http; using System.Threading.Tasks; @@ -10,7 +7,6 @@ using isn.Abstract; using System.Linq; using Xunit; using isn.abst; -using isnd.Entities; namespace isn.tests { @@ -22,12 +18,12 @@ namespace isn.tests { string pass = "a lame and big pass"; isn.IDataProtector _protector = new isn.DefaultDataProtector(); - string protectedpass = _protector.Protect(pass); - string unprotectedpass = _protector.UnProtect(protectedpass); - Console.WriteLine(protectedpass); - Assert.Equal(pass, unprotectedpass); - Assert.True(protectedpass != null); - Assert.True(protectedpass.Length > 0); + string protectedPassword = _protector.Protect(pass); + string unprotectedPassword = _protector.UnProtect(protectedPassword); + Console.WriteLine(protectedPassword); + Assert.Equal(pass, unprotectedPassword); + Assert.True(protectedPassword != null); + Assert.True(protectedPassword.Length > 0); } [Fact] @@ -49,7 +45,7 @@ namespace isn.tests { Program.LoadConfig(); var report = Program.PushPkg(new string[] { "./src/isn.abst/bin/Debug/isn.abst.1.0.1.nupkg" - + Constants.PaquetFileEstension }); + + Constants.PacketFileExtension }); } [Fact]