Bugfix/multiple file extract (#116)

* Fixed a bug where if a chapter had multiple archive files, they wouldn't all be extracted due to short circuit in ExtractArchive. Now I add the file id then flatten afterwards.

* Fixed a bug where due to how we were extracting for multiple files, the single file extractions failed.

* Bumped release for 3.5 release
This commit is contained in:
Joseph Milazzo 2021-03-27 15:20:55 -05:00 committed by GitHub
parent 280fdc07f2
commit 55d47eb1b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 5 deletions

View File

@ -42,13 +42,18 @@ namespace API.Services
{ {
EnsureCacheDirectory(); EnsureCacheDirectory();
var chapter = await _unitOfWork.VolumeRepository.GetChapterAsync(chapterId); var chapter = await _unitOfWork.VolumeRepository.GetChapterAsync(chapterId);
var fileCount = 0; var files = chapter.Files.ToList();
var fileCount = files.Count;
var extractPath = GetCachePath(chapterId); var extractPath = GetCachePath(chapterId);
var extraPath = "";
foreach (var file in chapter.Files) foreach (var file in files)
{ {
_archiveService.ExtractArchive(file.FilePath, Path.Join(extractPath, file.Id + "")); if (fileCount > 1)
fileCount++; {
extraPath = file.Id + "";
}
_archiveService.ExtractArchive(file.FilePath, Path.Join(extractPath, extraPath));
} }
if (fileCount > 1) if (fileCount > 1)

View File

@ -136,7 +136,7 @@ namespace API
applicationLifetime.ApplicationStopping.Register(OnShutdown); applicationLifetime.ApplicationStopping.Register(OnShutdown);
applicationLifetime.ApplicationStarted.Register(() => applicationLifetime.ApplicationStarted.Register(() =>
{ {
Console.WriteLine("Kavita - v0.3.1"); Console.WriteLine("Kavita - v0.3.5");
}); });
} }