Skip to content

Commit

Permalink
Wrong ToString
Browse files Browse the repository at this point in the history
  • Loading branch information
drasticactions committed Nov 6, 2023
1 parent 5d58e00 commit 42d9ba7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/FishyFlip/Models/FrameCommit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ public FrameCommit(CBORObject obj)
#pragma warning disable CS0618
this.Prev = obj["prev"]?.ToCid();
#pragma warning restore CS0618
this.Rev = obj["rev"]?.ToString();
this.Since = obj["since"]?.ToString();
this.Rev = obj["rev"]?.ToRawString();
this.Since = obj["since"]?.ToRawString();
this.Commit = obj["commit"].ToCid();
this.Repo = obj["repo"] is not null ? ATDid.Create(obj["repo"].AsString()) : null;
this.Handle = obj["handle"] is not null ? ATHandle.Create(obj["handle"].AsString()) : null;
Expand Down
12 changes: 3 additions & 9 deletions src/FishyFlip/Tools/Cbor/CborExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ internal static class CborExtensions
/// </summary>
/// <param name="obj">CBORObject.</param>
/// <returns>string.</returns>
public static string? ToString(this CBORObject obj)
public static string? ToRawString(this CBORObject obj)
{
if (obj.IsNull)
{
Expand Down Expand Up @@ -77,17 +77,11 @@ internal static class CborExtensions
return null;
}

var time = obj.ToString();
if (time is null)
{
return null;
}

try
{
return DateTime.Parse(time);
return DateTime.Parse(obj.AsString());
}
catch
catch (Exception ex)

Check warning on line 84 in src/FishyFlip/Tools/Cbor/CborExtensions.cs

View workflow job for this annotation

GitHub Actions / build

The variable 'ex' is declared but never used
{
return null;
}
Expand Down

0 comments on commit 42d9ba7

Please sign in to comment.