Add checks for resource strings (#930)

* Add checks for resource strings

* Don't use resource regex against png files
This commit is contained in:
Josh 2023-10-24 17:14:52 -05:00 committed by GitHub
parent 153bd75e26
commit 58664a2c7e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 53 additions and 10 deletions

View file

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