Skip to content

Commit

Permalink
Merge pull request #40 from Shivansps/mod-upload-fixes-20231112
Browse files Browse the repository at this point in the history
Sanitize pkg deps, banner image check typo, check directory before delete
  • Loading branch information
Shivansps authored Nov 12, 2023
2 parents 87814cd + 0498326 commit ad24c55
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions Knossos.NET/ViewModels/Templates/TaskItemViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,15 @@ private async Task<string> ReleaseMod(Mod mod, bool metaUpdate,CancellationToken
cleanMod.members = new List<ModMember>();
cleanMod.notes = mod.notes == null ? "" : mod.notes;

if(cleanMod.packages != null && cleanMod.packages.Any())
{
foreach(var pkg in cleanMod.packages)
{
if(pkg.dependencies == null)
pkg.dependencies = new ModDependency[0];
}
}

string? result;

if (!metaUpdate)
Expand Down Expand Up @@ -704,7 +713,7 @@ private async Task<bool> UploadModImages(Mod mod, CancellationTokenSource? cance
}
ProgressCurrent++;
//Banner
if (!string.IsNullOrEmpty(mod.tile))
if (!string.IsNullOrEmpty(mod.banner))
{
Info = "Banner Image";
mod.banner = await Nebula.UploadImage(mod.fullPath + Path.DirectorySeparatorChar + mod.banner);
Expand Down Expand Up @@ -1367,7 +1376,7 @@ public async Task<bool> UploadModVersion(Mod mod, bool isNewMod, bool metaOnly,
ProgressCurrent = ProgressBarMax;

//Delete kn_upload folder?
if (Knossos.globalSettings.deleteUploadedFiles)
if (Knossos.globalSettings.deleteUploadedFiles && Directory.Exists(mod.fullPath + Path.DirectorySeparatorChar + "kn_upload"))
{
try
{
Expand Down

0 comments on commit ad24c55

Please sign in to comment.