Skip to content

Commit 280bf06

Browse files
committed
fixed issue with files being incorrectly recognized as tar archives
1 parent 9a7846d commit 280bf06

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

AssemblyInfo.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
using System.Reflection;
33

44
[assembly: System.Reflection.AssemblyCompanyAttribute("subbuzz")]
5-
[assembly: System.Reflection.AssemblyCopyrightAttribute("Copyright © josdion, 2024")]
5+
[assembly: System.Reflection.AssemblyCopyrightAttribute("Copyright © josdion, 2025")]
66
[assembly: System.Reflection.AssemblyDescriptionAttribute("Subtitles plugin for emby and jellyfin")]
7-
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.2.1.0")]
8-
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.2.1.0")]
7+
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.2.2.0")]
8+
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.2.2.0")]
99
[assembly: System.Reflection.AssemblyProductAttribute("subbuzz")]
1010
[assembly: System.Reflection.AssemblyTitleAttribute("subbuzz")]
11-
[assembly: System.Reflection.AssemblyVersionAttribute("1.2.1.0")]
11+
[assembly: System.Reflection.AssemblyVersionAttribute("1.2.2.0")]
1212

Providers/Http/Download.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using MediaBrowser.Controller.Subtitles;
22
using SharpCompress.Archives;
3+
using SharpCompress.Common;
34
using subbuzz.Configuration;
45
using subbuzz.Extensions;
56
using subbuzz.Helpers;
@@ -66,7 +67,7 @@ public async Task<FileList> GetArchiveFiles(RequestSub link, CancellationToken c
6667
{
6768
try
6869
{
69-
res.AddRange(ReadArchive(resp.Content));
70+
res.AddRange(ReadArchive(resp.Content, resp.Info.FileName.GetPathExtension()));
7071
}
7172
catch
7273
{
@@ -157,12 +158,16 @@ public void AddResponseToCache(RequestCached link, Response resp)
157158
}
158159
}
159160

160-
private FileList ReadArchive(Stream content, string baseKey = null)
161+
private FileList ReadArchive(Stream content, string ext, string baseKey = null)
161162
{
162163
var res = new FileList();
163164

164165
using (IArchive arcreader = ArchiveFactory.Open(content))
165166
{
167+
// NOTE: fix issue with sharpcompress not able to detect properly tar archives
168+
if (arcreader.Type == ArchiveType.Tar && ext.ToLower() != "tar")
169+
throw new InvalidOperationException("Decompress only tar files with tar extension");
170+
166171
foreach (IArchiveEntry entry in arcreader.Entries)
167172
{
168173
if (!entry.IsDirectory)
@@ -181,7 +186,7 @@ private FileList ReadArchive(Stream content, string baseKey = null)
181186
try
182187
{
183188
// try to extract internal archives
184-
res.AddRange(ReadArchive(info.Content, info.Name));
189+
res.AddRange(ReadArchive(info.Content, info.Ext, info.Name));
185190
info.Dispose();
186191
}
187192
catch

0 commit comments

Comments
 (0)