Merge pull request #1440 from sbwalker/dev

handle versionless package names in installer
This commit is contained in:
Shaun Walker 2021-06-03 14:59:13 -04:00 committed by GitHub
commit 7c7dbfe638
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -103,11 +103,19 @@ namespace Oqtane.Infrastructure
List<string> assets = new List<string>();
bool manifest = false;
// packages are in form of name.1.0.0.nupkg or name.culture.1.0.0.nupkg
// remove version information from package name
string name = Path.GetFileNameWithoutExtension(packagename);
string[] segments = name?.Split('.');
// remove version information from name
if (segments != null) name = string.Join('.', segments, 0, segments.Length - 3);
string[] segments = name.Split('.');
// packages are in form of name.1.0.0.nupkg or name.culture.1.0.0.nupkg or name.nupkg (versionless)
try
{
if (segments.Length > 3)
{
Version version = Version.Parse(string.Join('.', segments, segments.Length - 3, 3));
name = string.Join('.', segments, 0, segments.Length - 3);
}
}
catch { } // no version in packagename
// deploy to appropriate locations
foreach (ZipArchiveEntry entry in archive.Entries)