mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-17 03:00:13 +00:00
fix: properly fall back to regular Url if CleanUrl is not present
This commit is contained in:
parent
bacc328417
commit
6d3c73d017
6 changed files with 9 additions and 9 deletions
|
|
@ -52,7 +52,7 @@ public static class ContextAvatarExt
|
|||
public struct ParsedImage
|
||||
{
|
||||
public string Url;
|
||||
public string CleanUrl;
|
||||
public string? CleanUrl;
|
||||
public AvatarSource Source;
|
||||
public User? SourceUser;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -263,7 +263,7 @@ public class Groups
|
|||
|
||||
await AvatarUtils.VerifyAvatarOrThrow(_client, img.Url);
|
||||
|
||||
await ctx.Repository.UpdateGroup(target.Id, new GroupPatch { Icon = img.CleanUrl });
|
||||
await ctx.Repository.UpdateGroup(target.Id, new GroupPatch { Icon = img.CleanUrl ?? img.Url });
|
||||
|
||||
var msg = img.Source switch
|
||||
{
|
||||
|
|
@ -328,7 +328,7 @@ public class Groups
|
|||
|
||||
await AvatarUtils.VerifyAvatarOrThrow(_client, img.Url, true);
|
||||
|
||||
await ctx.Repository.UpdateGroup(target.Id, new GroupPatch { BannerImage = img.CleanUrl });
|
||||
await ctx.Repository.UpdateGroup(target.Id, new GroupPatch { BannerImage = img.CleanUrl ?? img.Url });
|
||||
|
||||
var msg = img.Source switch
|
||||
{
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ public class Member
|
|||
img.CleanUrl = uriBuilder.Uri.AbsoluteUri;
|
||||
|
||||
await AvatarUtils.VerifyAvatarOrThrow(_client, img.Url);
|
||||
await ctx.Repository.UpdateMember(member.Id, new MemberPatch { AvatarUrl = img.CleanUrl }, conn);
|
||||
await ctx.Repository.UpdateMember(member.Id, new MemberPatch { AvatarUrl = img.CleanUrl ?? img.Url }, conn);
|
||||
|
||||
dispatchData.Add("avatar_url", img.CleanUrl);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ public class MemberAvatar
|
|||
|
||||
ctx.CheckSystem().CheckOwnMember(target);
|
||||
await AvatarUtils.VerifyAvatarOrThrow(_client, avatarArg.Value.Url);
|
||||
await UpdateAvatar(location, ctx, target, avatarArg.Value.CleanUrl);
|
||||
await UpdateAvatar(location, ctx, target, avatarArg.Value.CleanUrl ?? avatarArg.Value.Url);
|
||||
await PrintResponse(location, ctx, target, avatarArg.Value, guildData);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ public class MemberEdit
|
|||
{
|
||||
await AvatarUtils.VerifyAvatarOrThrow(_client, img.Url, true);
|
||||
|
||||
await ctx.Repository.UpdateMember(target.Id, new MemberPatch { BannerImage = img.CleanUrl });
|
||||
await ctx.Repository.UpdateMember(target.Id, new MemberPatch { BannerImage = img.CleanUrl ?? img.Url });
|
||||
|
||||
var msg = img.Source switch
|
||||
{
|
||||
|
|
|
|||
|
|
@ -475,7 +475,7 @@ public class SystemEdit
|
|||
|
||||
await AvatarUtils.VerifyAvatarOrThrow(_client, img.Url);
|
||||
|
||||
await ctx.Repository.UpdateSystem(target.Id, new SystemPatch { AvatarUrl = img.CleanUrl });
|
||||
await ctx.Repository.UpdateSystem(target.Id, new SystemPatch { AvatarUrl = img.CleanUrl ?? img.Url });
|
||||
|
||||
var msg = img.Source switch
|
||||
{
|
||||
|
|
@ -543,7 +543,7 @@ public class SystemEdit
|
|||
|
||||
await AvatarUtils.VerifyAvatarOrThrow(_client, img.Url);
|
||||
|
||||
await ctx.Repository.UpdateSystemGuild(target.Id, ctx.Guild.Id, new SystemGuildPatch { AvatarUrl = img.CleanUrl });
|
||||
await ctx.Repository.UpdateSystemGuild(target.Id, ctx.Guild.Id, new SystemGuildPatch { AvatarUrl = img.CleanUrl ?? img.Url });
|
||||
|
||||
var msg = img.Source switch
|
||||
{
|
||||
|
|
@ -640,7 +640,7 @@ public class SystemEdit
|
|||
{
|
||||
await AvatarUtils.VerifyAvatarOrThrow(_client, img.Url, true);
|
||||
|
||||
await ctx.Repository.UpdateSystem(target.Id, new SystemPatch { BannerImage = img.CleanUrl });
|
||||
await ctx.Repository.UpdateSystem(target.Id, new SystemPatch { BannerImage = img.CleanUrl ?? img.Url });
|
||||
|
||||
var msg = img.Source switch
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue