Skip to content

Commit 1851504

Browse files
authored
Checks if URL is archived before redirecting. (#561)
Adds a check to determine if a shortened URL is archived. If the URL is archived, it returns immediately, preventing further processing and redirection. Co-authored-by: Frank Boucher
1 parent 6b857ef commit 1851504

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/Core/Service/UrlServices.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ public async Task<string> Redirect(string? shortUrl)
3737
if (newUrl != null)
3838
{
3939
_logger.LogInformation($"Found it: {newUrl.Url}");
40+
41+
if (newUrl.IsArchived ?? false)
42+
{
43+
_logger.LogInformation($"This URL is archived.");
44+
return redirectUrl;
45+
}
46+
4047
newUrl.Clicks++;
4148
await _stgHelper.SaveClickStatsEntity(new ClickStatsEntity(newUrl.RowKey));
4249
await _stgHelper.SaveShortUrlEntity(newUrl);

0 commit comments

Comments
 (0)