浏览代码

Merge pull request #2483 from xosdy/fix-download-filename

Fix download file with non-ASCII filename
Bond-009 5 年之前
父节点
当前提交
20ac3c36e2
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      MediaBrowser.Api/Library/LibraryService.cs

+ 1 - 1
MediaBrowser.Api/Library/LibraryService.cs

@@ -815,7 +815,7 @@ namespace MediaBrowser.Api.Library
             if (!string.IsNullOrWhiteSpace(filename))
             {
                 // Kestrel doesn't support non-ASCII characters in headers
-                if (Regex.IsMatch(filename, "[^[:ascii:]]"))
+                if (Regex.IsMatch(filename, @"[^\p{IsBasicLatin}]"))
                 {
                     // 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);