From 36043df15a99d850ba584dfe37b7c55e6254a67f Mon Sep 17 00:00:00 2001 From: Mikal Stordal Date: Thu, 10 Oct 2024 20:45:47 +0200 Subject: [PATCH] fix: don't assume directory name is not nullable since it can be null. --- Shoko.Server/Renamer/RenameFileService.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Shoko.Server/Renamer/RenameFileService.cs b/Shoko.Server/Renamer/RenameFileService.cs index 143438798..522ce4486 100644 --- a/Shoko.Server/Renamer/RenameFileService.cs +++ b/Shoko.Server/Renamer/RenameFileService.cs @@ -237,8 +237,8 @@ private static RelocationResult UnAbstractResult(SVR_VideoLocal_Place place, Abs var newImportFolder = shouldMove && !result.SkipMove ? result.DestinationImportFolder! : place.ImportFolder!; var newFileName = shouldRename && !result.SkipRename ? result.FileName! : place.FileName; - var newRelativeDirectory = shouldMove && !result.SkipMove ? result.Path! : Path.GetDirectoryName(place.FilePath)!; - var newRelativePath = newRelativeDirectory.Length > 0 ? Path.Combine(newRelativeDirectory, newFileName) : newFileName; + var newRelativeDirectory = shouldMove && !result.SkipMove ? result.Path : Path.GetDirectoryName(place.FilePath); + var newRelativePath = !string.IsNullOrEmpty(newRelativeDirectory) && newRelativeDirectory.Length > 0 ? Path.Combine(newRelativeDirectory, newFileName) : newFileName; var newFullPath = Path.Combine(newImportFolder.Path, newRelativePath); return new() {