Hi @jw ,
I'm not able to reproduce any issues on my end; I'm not entirely sure how you're testing, but let me share with you the code on the server side in ProGet:
private static async Task UpdateLicenseAsync(AhHttpContext context, LoggedResponseStream output, WebApiContext apiContext)
{
EnsureMethod(context, "POST");
EnsureCanManageLicenses(apiContext);
var input = await JsonSerializer.DeserializeAsync(context.Request.InputStream, LicenseApiJsonContext.Default.LicenseInfo, context.CancellationToken)
?? throw new HttpException(400, "Expected license object.");
var license = await DB.Licenses_GetLicenseAsync(External_Id: input.Code)
?? throw new HttpException(404, "License not found.");
List<int>? nameIds = null;
if (input.PackageNames?.Count > 0)
{
nameIds = [];
foreach (var n in input.PackageNames)
{
if (!PackageNameId.TryParse(n, out var nameId))
throw new HttpException(400, $"Invalid package name: {n}");
nameIds.Add((await nameId.EnsureDatabaseIdAsync()).Id!.Value);
}
}
List<int>? versionIds = null;
if (input.Purls?.Count > 0)
{
versionIds = [];
foreach (var v in input.Purls)
{
if (!PUrl.TryParse(v, out var purl))
throw new HttpException(400, $"Invalid purl: {v}");
versionIds.Add((await ((PackageVersionId)purl).EnsureDatabaseIdAsync()).Id!.Value);
}
}
await DB.Licenses_UpdateLicenseDataAsync(
License_Id: license.License_Id,
PackageVersionIds_Csv: versionIds?.Count > 0 ? string.Join(',', versionIds) : null,
PackageNameIds_Csv: nameIds?.Count > 0 ? string.Join(',', nameIds) : null,
SpdxIds_Csv: input.Spdx?.Count > 0 ? string.Join(',', input.Spdx) : null,
Urls_Csv: input.Urls?.Count > 0 ? string.Join(',', input.Urls) : null
);
}
I'm not sure if that's helpful, but if not... can you put a specific reproduction case?
Also note that the license data in the UI is cached, but it's invalidated when you visit the /licenses
page and others.
Thanks,
Steve