Merge pull request #107 from BinaryAlley/refactor/corrects-media-library-cover-storage-internal-path

Corrects media library cover storage internal path
This commit is contained in:
BinaryAlley authored and GitHub committed 2025-01-12 08:43:27 +00:00
commit 53d51c2d81
3 files changed
+7 -3

No files matched your search

@@ -192,7 +192,11 @@ public class LibrarySavedDomainEventHandler : INotificationHandler<LibrarySavedD
if (renameFileResult.IsError)
return renameFileResult.Errors;
return $"cover.{imageCheckResult.Value.ToString().ToLower()}";
// get the internal relative path for the copied file
string relativePath = renameFileResult.Value.Path[AppContext.BaseDirectory.Length..];
if (!relativePath.StartsWith(_pathService.PathSeparator))
relativePath = $"{_pathService.PathSeparator}{relativePath}";
return relativePath;
}
/// <summary>
@@ -44,7 +44,7 @@
libraryDiv.className = 'media-panel';
libraryDiv.innerHTML = `
<img src="${globalConfiguration.serverBasePath}/media/libraries/${library.id}/${library.coverImage}" />
<img src="${globalConfiguration.serverBasePath}/media/libraries/${library.id}/${library.coverImage.substring(library.coverImage.lastIndexOf('cover.'))}" />
<span class="text-light-two"><strong>${library.title}</strong></span>
`;
@@ -72,7 +72,7 @@
if (await dialogService.show('@_localizer["DeleteLibraryConfirm"]'.replace('{0}', libraryTitle),
jsLocalizedDialogs.confirmation, DialogButtons.YES_NO, DialogIcon.QUESTION) === DialogButton.YES) {
const libraryId = row.querySelector('a').href.split('id=')[1];
const libraryId = row.querySelector('a').href.split('/').pop();
const url = '@_urlService.GetAbsoluteUrl("DeleteLibrary", "LibraryManagement", new { id = default(Guid) })';
const success = await callApiDeleteAsync(url.replace('/@(default(Guid))', `/${libraryId}`));