From 703e32a30e33c934a2f64d38a2c8a152fb794bb0 Mon Sep 17 00:00:00 2001 From: Glax Date: Sat, 17 May 2025 22:38:12 +0200 Subject: [PATCH] Check if directorypath is null --- API/Schema/Jobs/DownloadSingleChapterJob.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/API/Schema/Jobs/DownloadSingleChapterJob.cs b/API/Schema/Jobs/DownloadSingleChapterJob.cs index 564d181..e88a01b 100644 --- a/API/Schema/Jobs/DownloadSingleChapterJob.cs +++ b/API/Schema/Jobs/DownloadSingleChapterJob.cs @@ -52,9 +52,16 @@ public class DownloadSingleChapterJob : Job return []; } string saveArchiveFilePath = Chapter.FullArchiveFilePath; + Log.Debug($"Chapter path: {saveArchiveFilePath}"); //Check if Publication Directory already exists - string directoryPath = Path.GetDirectoryName(saveArchiveFilePath)!; + string? directoryPath = Path.GetDirectoryName(saveArchiveFilePath); + if (directoryPath is null) + { + Log.Error($"Directory path could not be found: {saveArchiveFilePath}"); + this.state = JobState.Failed; + return []; + } if (!Directory.Exists(directoryPath)) { Log.Info($"Creating publication Directory: {directoryPath}");