Fix earth hash not being able to reset to nothing

Closes #383
This commit is contained in:
jvyden 2022-08-01 01:12:43 -04:00
parent 48f01f15a1
commit 34d0ec0337
No known key found for this signature in database
GPG key ID: 18BCF2BE0262B278

View file

@ -104,9 +104,15 @@ public class UserController : ControllerBase
user.Biography = update.Biography;
}
// ReSharper disable once LoopCanBeConvertedToQuery
foreach (string? resource in new[]{update.IconHash, update.YayHash, update.MehHash, update.BooHash, update.PlanetHash,})
{
if (resource != null && !resource.StartsWith('g') && !FileHelper.ResourceExists(resource)) return this.BadRequest();
if (resource == "0") continue;
if (resource != null && !resource.StartsWith('g') && !FileHelper.ResourceExists(resource))
{
return this.BadRequest();
}
}
if (update.IconHash != null) user.IconHash = update.IconHash;