From 442d9493719a74b76e9726e2ed756561ba963af3 Mon Sep 17 00:00:00 2001 From: glax Date: Sun, 12 Nov 2023 13:03:33 +0100 Subject: [PATCH] Fix #80 UpdateMetaData failing --- Tranga/Server.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Tranga/Server.cs b/Tranga/Server.cs index 6408a0d..7f3e3ce 100644 --- a/Tranga/Server.cs +++ b/Tranga/Server.cs @@ -307,9 +307,11 @@ public class Server : GlobalBase case "Jobs/UpdateMetadata": if (!requestVariables.TryGetValue("internalId", out internalId)) { - foreach (DownloadNewChapters dncJob in (_parent.jobBoss.jobs.Where(possibleDncJob => - possibleDncJob is DownloadNewChapters) as IEnumerable)!) + foreach (Job pJob in _parent.jobBoss.jobs.Where(possibleDncJob => + possibleDncJob.jobType is Job.JobType.DownloadNewChaptersJob).ToArray())//ToArray to avoid modyifying while adding new jobs { + DownloadNewChapters dncJob = pJob as DownloadNewChapters ?? + throw new Exception("Has to be DownloadNewChapters Job"); _parent.jobBoss.AddJob(new UpdateMetadata(this, dncJob.mangaConnector, dncJob.manga)); } SendResponse(HttpStatusCode.Accepted, response);