get prereleases from restoration by default

Fixes the .nupkgs pushes
This commit is contained in:
2025-07-07 15:52:03 +01:00
parent b97f3d3575
commit 26e253a3ab
9 changed files with 30 additions and 24 deletions

View File

@ -29,6 +29,9 @@ namespace isnd.Controllers
s=>s.Name==version); s=>s.Name==version);
var pkgNameSpec=$"{id}-{version}.{Constants.PacketFileExtension}"; var pkgNameSpec=$"{id}-{version}.{Constants.PacketFileExtension}";
if (pkgVersionDirInfo == null)
return NotFound();
FileInfo pkgFileInfo = pkgVersionDirInfo.GetFiles() FileInfo pkgFileInfo = pkgVersionDirInfo.GetFiles()
.FirstOrDefault(p=>string.Compare(p.Name,pkgNameSpec, .FirstOrDefault(p=>string.Compare(p.Name,pkgNameSpec,
System.StringComparison.InvariantCultureIgnoreCase)==0); System.StringComparison.InvariantCultureIgnoreCase)==0);

View File

@ -12,7 +12,7 @@ namespace isnd.Controllers
public IActionResult GetVersions( public IActionResult GetVersions(
string id, string id,
string version, string version,
bool prerelease = false, bool prerelease = true,
string packageType = null, string packageType = null,
int skip = 0, int skip = 0,
int take = 50) int take = 50)

View File

@ -8,6 +8,7 @@ using Microsoft.Extensions.Logging;
using isnd.Entities; using isnd.Entities;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using isn.abst; using isn.abst;
using System.IO;
namespace isnd.Controllers namespace isnd.Controllers
{ {
@ -35,8 +36,19 @@ namespace isnd.Controllers
} }
foreach (IFormFile file in Request.Form.Files) foreach (IFormFile file in Request.Form.Files)
{ {
var version = await packageManager.PutPackageAsync(file.OpenReadStream(), dbApiKey.UserId); FileInfo inputFileInfo = new FileInfo(file.Name);
logger.LogInformation($"new package : {version.PackageId} {version.NugetLink}"); switch (inputFileInfo.Extension)
{
case "nupkg":
case "nupkgs":
var libVersion = await packageManager.PutPackageAsync(inputFileInfo.Extension, file.OpenReadStream(), dbApiKey.UserId);
logger.LogInformation($"new package : {libVersion.PackageId} {libVersion.NugetLink}");
break;
default:
logger.LogInformation($"file extension is not supported : {inputFileInfo.Extension}");
break;
}
} }
return Ok(); return Ok();
} }

View File

@ -18,7 +18,7 @@ namespace isnd.Controllers
string q=null, string q=null,
int skip=0, int skip=0,
int take=25, int take=25,
bool prerelease=false, bool prerelease=true,
string semVerLevel = "2.0.0", string semVerLevel = "2.0.0",
string packageType = "Dependency") string packageType = "Dependency")
{ {

View File

@ -30,7 +30,7 @@ namespace isnd.Interfaces
Task<PackageSearchResult> SearchPackageAsync(PackageRegistrationQuery query); Task<PackageSearchResult> SearchPackageAsync(PackageRegistrationQuery query);
Task<PackageVersion> PutPackageAsync(Stream packageStream, string ownerId); Task<PackageVersion> PutPackageAsync(string fileExtension, Stream packageStream, string ownerId);
} }
} }

View File

@ -396,7 +396,7 @@ namespace isnd.Services
return new PackageSearchResult(packages, apiBase, count); return new PackageSearchResult(packages, apiBase, count);
} }
public async Task<PackageVersion> PutPackageAsync(Stream packageStream, string ownerId) public async Task<PackageVersion> PutPackageAsync(string fileExtension, Stream packageStream, string ownerId)
{ {
PackageVersion version = null; PackageVersion version = null;
using (packageStream) using (packageStream)
@ -441,7 +441,7 @@ namespace isnd.Services
string packageIdPath = Path.Combine(isndSettings.PackagesRootDir, string packageIdPath = Path.Combine(isndSettings.PackagesRootDir,
pkgId); pkgId);
pkgPath = Path.Combine(packageIdPath, nugetVersion.ToFullString()); pkgPath = Path.Combine(packageIdPath, nugetVersion.ToFullString());
string name = $"{pkgId}-{nugetVersion}." + Constants.PacketFileExtension; string name = $"{pkgId}-{nugetVersion}." + fileExtension;
fullPath = Path.Combine(pkgPath, name); fullPath = Path.Combine(pkgPath, name);
var authors = xMetaElements.FirstOrDefault(x => x.Name.LocalName == "authors")?.Value; var authors = xMetaElements.FirstOrDefault(x => x.Name.LocalName == "authors")?.Value;

View File

@ -52,7 +52,10 @@ namespace isnd
.Configure<AdminStartupList>(adminStartupListConf) .Configure<AdminStartupList>(adminStartupListConf)
.Configure<MigrationsEndPointOptions>(o => o.Path = "~/migrate") .Configure<MigrationsEndPointOptions>(o => o.Path = "~/migrate")
.AddDbContext<ApplicationDbContext>(options => .AddDbContext<ApplicationDbContext>(options =>
options.UseNpgsql(Configuration.GetConnectionString("DefaultConnection"))) options.UseNpgsql(Configuration.GetConnectionString("DefaultConnection"))
.ConfigureWarnings(w => w.Ignore(RelationalEventId.PendingModelChangesWarning))
.EnableDetailedErrors()
)
.AddIdentity<ApplicationUser, IdentityRole>() .AddIdentity<ApplicationUser, IdentityRole>()
.AddRoles<IdentityRole>() .AddRoles<IdentityRole>()
.AddEntityFrameworkStores<ApplicationDbContext>( .AddEntityFrameworkStores<ApplicationDbContext>(

View File

@ -18,11 +18,6 @@
"SenderName": "<from-name>", "SenderName": "<from-name>",
"SenderEmail": "<from-email>" "SenderEmail": "<from-email>"
}, },
"Unleash":
{
"ClientApiKey": "lame-unleash-client-api-key",
"ApiUrl": "http://localhost:4242/api/"
},
"Logging": { "Logging": {
"LogLevel": { "LogLevel": {
"Default": "Warning" "Default": "Warning"

View File

@ -11,11 +11,4 @@
<Version>1.0.7</Version> <Version>1.0.7</Version>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
</ItemGroup>
<ItemGroup>
</ItemGroup>
<ItemGroup>
<PackageReference Include="isn.abst" Version="1.0.24" />
</ItemGroup>
</Project> </Project>