|
|
@ -2,6 +2,8 @@ using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.IO;
|
|
|
|
using System.IO;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
using System.Net;
|
|
|
|
|
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
using System.Threading;
|
|
|
|
using System.Threading;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using MediaBrowser.Api.Movies;
|
|
|
|
using MediaBrowser.Api.Movies;
|
|
|
@ -827,9 +829,18 @@ namespace MediaBrowser.Api.Library
|
|
|
|
// Quotes are valid in linux. They'll possibly cause issues here
|
|
|
|
// Quotes are valid in linux. They'll possibly cause issues here
|
|
|
|
var filename = (Path.GetFileName(path) ?? string.Empty).Replace("\"", string.Empty);
|
|
|
|
var filename = (Path.GetFileName(path) ?? string.Empty).Replace("\"", string.Empty);
|
|
|
|
if (!string.IsNullOrWhiteSpace(filename))
|
|
|
|
if (!string.IsNullOrWhiteSpace(filename))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// Kestrel doesn't support non-ASCII characters in headers
|
|
|
|
|
|
|
|
if (Regex.IsMatch(filename, "[^[:ascii:]]"))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// Manually encoding non-ASCII characters, following https://tools.ietf.org/html/rfc5987#section-3.2.2
|
|
|
|
|
|
|
|
headers[HeaderNames.ContentDisposition] = "attachment; filename*=UTF-8''" + WebUtility.UrlEncode(filename);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
headers[HeaderNames.ContentDisposition] = "attachment; filename=\"" + filename + "\"";
|
|
|
|
headers[HeaderNames.ContentDisposition] = "attachment; filename=\"" + filename + "\"";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return ResultFactory.GetStaticFileResult(Request, new StaticFileResultOptions
|
|
|
|
return ResultFactory.GetStaticFileResult(Request, new StaticFileResultOptions
|
|
|
|
{
|
|
|
|
{
|
|
|
|