From c7f0a8578a1f883a9d367431a3b6fac7e157a6d5 Mon Sep 17 00:00:00 2001 From: ta264 Date: Sat, 15 Jan 2022 06:04:15 +0000 Subject: [PATCH] Fixed: Calibre auth check when library missing --- src/NzbDrone.Core/Books/Calibre/CalibreProxy.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/NzbDrone.Core/Books/Calibre/CalibreProxy.cs b/src/NzbDrone.Core/Books/Calibre/CalibreProxy.cs index 4535084e7..c18b204e5 100644 --- a/src/NzbDrone.Core/Books/Calibre/CalibreProxy.cs +++ b/src/NzbDrone.Core/Books/Calibre/CalibreProxy.cs @@ -681,6 +681,11 @@ namespace NzbDrone.Core.Books.Calibre } } + if (settings.Library.IsNullOrWhiteSpace()) + { + settings.Library = libraryInfo.DefaultLibrary; + } + // now that we have library info, double check if auth is actually enabled calibre side. If not, we'll get a 404 back. // https://github.com/kovidgoyal/calibre/blob/bf53bbf07a6ced728bf6a87d097fb6eb8c67e4e0/src/calibre/srv/books.py#L196 if (authRequired && !CalibreLoginEnabled(settings)) @@ -688,11 +693,6 @@ namespace NzbDrone.Core.Books.Calibre return new ValidationFailure("Host", "Remote calibre server must have authentication enabled to allow Readarr write access"); } - if (settings.Library.IsNullOrWhiteSpace()) - { - settings.Library = libraryInfo.DefaultLibrary; - } - if (!libraryInfo.LibraryMap.ContainsKey(settings.Library)) { return new ValidationFailure("Library", "Not a valid library in calibre");