Skip to content

Commit

Permalink
fix: urls
Browse files Browse the repository at this point in the history
  • Loading branch information
ilGianfri committed Nov 24, 2024
1 parent 90e0406 commit 5351199
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/TwitterSky/TweetImporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,12 @@ await Task.Run(() =>
List<Facet> facets = [];
if (urls.Count > 0)
{
foreach (Url url in urls)
{
// Replace url with expanded url
tweetContent = tweetContent.Replace(url.UrlUrl.ToString(), url.ExpandedUrl.ToString());
}

facets.AddRange(Facet.ForUris(tweetContent));

_cmd.PrintInfo($"Replaced {urls.Count} URLs.");
Expand Down Expand Up @@ -416,14 +422,14 @@ await blobResult.SwitchAsync(
// Create a post with the images
postResult = await _bskyProtocol.Repo.CreatePostAsync(textContent, facets: [.. facets], createdAt: createdAt, reply: reply, embed: new ImagesEmbed(bskyImages.Select(x => new ImageEmbed(x, "")).ToArray()));

_cmd.PrintInfo($"{createdAt.ToShortDateString()}: {textContent} with {imageUrls.Count} images");
_cmd.PrintSuccess($"{createdAt.ToShortDateString()}: {textContent} with {imageUrls.Count} images");
}
}
else
{
postResult = await _bskyProtocol.Repo.CreatePostAsync(textContent, facets: [.. facets], createdAt: createdAt, reply: reply);

_cmd.PrintInfo($"{createdAt.ToShortDateString()}: {textContent}");
_cmd.PrintSuccess($"{createdAt.ToShortDateString()}: {textContent}");
}

if (postResult?.Value is ATError error)
Expand Down

0 comments on commit 5351199

Please sign in to comment.