mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
re-write a couple file extensions to .txt
This commit is contained in:
parent
1241f90189
commit
277d0641f1
1 changed files with 3 additions and 1 deletions
|
|
@ -1,4 +1,5 @@
|
|||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
|
@ -24,6 +25,7 @@ public Command(ListInfo listInfo)
|
|||
public class Handler : AsyncRequestHandler<Command>
|
||||
{
|
||||
private const string RepoDirectory = @"archives";
|
||||
private readonly string[] _extensionsToRewrite = { "", ".aspx", ".p2p", ".php" };
|
||||
private readonly HttpClient _httpClient;
|
||||
|
||||
public Handler(AgentHttpClient httpClient)
|
||||
|
|
@ -34,7 +36,7 @@ public Handler(AgentHttpClient httpClient)
|
|||
protected override async Task Handle(Command request, CancellationToken cancellationToken)
|
||||
{
|
||||
var sourceExtension = request.ListInfo.ViewUrl.GetExtension();
|
||||
var destinationExtension = string.IsNullOrEmpty(sourceExtension) ? ".txt" : sourceExtension;
|
||||
var destinationExtension = _extensionsToRewrite.Contains(sourceExtension) ? ".txt" : sourceExtension;
|
||||
var destinationPath = Path.Combine(RepoDirectory, $"{request.ListInfo.Id}{destinationExtension}");
|
||||
using (var response = await _httpClient.GetAsync(request.ListInfo.ViewUrl, cancellationToken))
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue