Skip to content

Commit

Permalink
Update to v0.1.0-rc2-hotfix2 (#82)
Browse files Browse the repository at this point in the history
* Fix texture URLs to only set when GUIDs are not empty

Previously, texture URLs for skin and cape were always set regardless of whether their GUIDs were empty. This change ensures that texture URLs are set conditionally, only if the respective GUIDs are not null or empty, preventing potential issues with blank URLs.
  • Loading branch information
GamerVII-NET authored Oct 16, 2024
1 parent 6086381 commit 88172a3
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/Gml.Core
Submodule Gml.Core updated 0 files
56 changes: 34 additions & 22 deletions src/Gml.Web.Api/Core/Handlers/MinecraftHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,19 +87,25 @@ public static async Task<IResult> HasJoined(HttpContext context, IGmlManager gml
Timestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(),
ProfileName = user.Name,
ProfileId = user.Uuid,
Textures = new Textures
{
Skin = new SkinCape
{
Url = string.Concat(address, $"/api/v1/integrations/texture/skins/{user.TextureSkinGuid}")
},
Cape = new SkinCape
{
Url = string.Concat(address, $"/api/v1/integrations/texture/capes/{user.TextureCloakGuid}")
}
}
Textures = new Textures()
};

if (!string.IsNullOrEmpty(user.TextureSkinGuid))
{
texture.Textures.Skin = new SkinCape
{
Url = string.Concat(address, $"/api/v1/integrations/texture/skins/{user.TextureSkinGuid}")
};
}

if (!string.IsNullOrEmpty(user.TextureSkinGuid))
{
texture.Textures.Cape = new SkinCape
{
Url = string.Concat(address, $"/api/v1/integrations/texture/capes/{user.TextureCloakGuid}")
};
}

var jsonData = JsonConvert.SerializeObject(texture);

Debug.WriteLine($"New user {jsonData}");
Expand Down Expand Up @@ -154,19 +160,25 @@ public static async Task<IResult> GetProfile(HttpContext context, IGmlManager gm
ProfileName = user.Name,
ProfileId = uuid,
SignatureRequired = unsigned == false,
Textures = new Textures
{
Skin = new SkinCape
{
Url = string.Concat(address, $"/api/v1/integrations/texture/skins/{user.TextureSkinGuid}")
},
Cape = new SkinCape
{
Url = string.Concat(address, $"/api/v1/integrations/texture/capes/{user.TextureCloakGuid}")
}
}
Textures = new Textures()
};

if (!string.IsNullOrEmpty(user.TextureSkinGuid))
{
texture.Textures.Skin = new SkinCape
{
Url = string.Concat(address, $"/api/v1/integrations/texture/skins/{user.TextureSkinGuid}")
};
}

if (!string.IsNullOrEmpty(user.TextureSkinGuid))
{
texture.Textures.Cape = new SkinCape
{
Url = string.Concat(address, $"/api/v1/integrations/texture/capes/{user.TextureCloakGuid}")
};
}

var jsonData = JsonConvert.SerializeObject(texture);

Debug.WriteLine($"New user {jsonData}");
Expand Down

0 comments on commit 88172a3

Please sign in to comment.