on publish, another pass to filter distasteful chars in filenames

turns out *nix has _no_ problem with colons, but android does
This commit is contained in:
Adam R Grey 2023-04-15 08:25:38 -04:00
parent 7e6b0fbc40
commit 9d252ee0d3

View File

@ -16,7 +16,14 @@ namespace ttrss_co_client.tasks
{ {
Directory.CreateDirectory(targetDirectory); Directory.CreateDirectory(targetDirectory);
} }
File.Move(workOrder.data["path"], Path.Combine(workOrder.data["publish-target"], Path.GetFileName(workOrder.data["path"])), true);
var outputFilename = Path.Combine(workOrder.data["publish-target"], Path.GetFileName(workOrder.data["path"]));
foreach(char c in "'\":\\?")
{
outputFilename = outputFilename.Replace(c, ' ');
}
File.Move(workOrder.data["path"], outputFilename, true);
var article = (await TtrssClient.GetArticles(workOrder.articleId))?.FirstOrDefault(); var article = (await TtrssClient.GetArticles(workOrder.articleId))?.FirstOrDefault();
await TtrssClient.UpdateArticleNote($"{article.note}\n[{DateTime.Now.ToString("o")}] - copied", article.id); await TtrssClient.UpdateArticleNote($"{article.note}\n[{DateTime.Now.ToString("o")}] - copied", article.id);
return new Tuple<TaskStatus, WorkOrder>(TaskStatus.Done, workOrder); return new Tuple<TaskStatus, WorkOrder>(TaskStatus.Done, workOrder);