mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-05 07:18:47 +01:00
fixed plugin assembly downloads as well as debug/release detection with nuget assemblies
This commit is contained in:
@@ -241,6 +241,10 @@ namespace MediaBrowser.Common.Net
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (contentType.StartsWith("application/", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -257,7 +261,10 @@ namespace MediaBrowser.Common.Net
|
||||
if (!compress || string.IsNullOrEmpty(RequestContext.CompressionType))
|
||||
{
|
||||
Response.ContentType = contentType;
|
||||
return await factoryFn().ConfigureAwait(false);
|
||||
|
||||
var stream = await factoryFn().ConfigureAwait(false);
|
||||
|
||||
return new StreamWriter(stream);
|
||||
}
|
||||
|
||||
string content;
|
||||
|
||||
@@ -173,7 +173,7 @@ namespace MediaBrowser.Common.Net
|
||||
// Misc
|
||||
if (ext.Equals(".dll", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return "application/x-msdownload";
|
||||
return "application/octet-stream";
|
||||
}
|
||||
|
||||
// Web
|
||||
|
||||
48
MediaBrowser.Common/Net/StreamWriter.cs
Normal file
48
MediaBrowser.Common/Net/StreamWriter.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using ServiceStack.Service;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MediaBrowser.Common.Net
|
||||
{
|
||||
/// <summary>
|
||||
/// Class StreamWriter
|
||||
/// </summary>
|
||||
public class StreamWriter : IStreamWriter
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the source stream.
|
||||
/// </summary>
|
||||
/// <value>The source stream.</value>
|
||||
public Stream SourceStream { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="StreamWriter" /> class.
|
||||
/// </summary>
|
||||
/// <param name="source">The source.</param>
|
||||
public StreamWriter(Stream source)
|
||||
{
|
||||
SourceStream = source;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Writes to.
|
||||
/// </summary>
|
||||
/// <param name="responseStream">The response stream.</param>
|
||||
public void WriteTo(Stream responseStream)
|
||||
{
|
||||
var task = WriteToAsync(responseStream);
|
||||
|
||||
Task.WaitAll(task);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Writes to async.
|
||||
/// </summary>
|
||||
/// <param name="responseStream">The response stream.</param>
|
||||
/// <returns>Task.</returns>
|
||||
private Task WriteToAsync(Stream responseStream)
|
||||
{
|
||||
return SourceStream.CopyToAsync(responseStream);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user