OSDN Git Service

na-get-lib, 「#32514 Markdown#Editorインストール不可能」RFC1806に準拠していないContent-Dispositionヘッダに対す...
[applistation/AppliStation.git] / na-get-lib / NaGet.SubCommands.SubTask / DownloadSubTask.cs
index 891d50e..48dd8e2 100644 (file)
@@ -351,6 +351,12 @@ namespace NaGet.SubCommands.SubTask
                                string contentDisposition = httpresp.Headers["Content-Disposition"];
                                
                                if (! string.IsNullOrEmpty(contentDisposition)) {
+                                       // おかしな Content-Disposition ヘッダ向け
+                                       //(Content-Disposition: filename=\"...\" に attachment; を補って RFC1806 に準拠させる)
+                                       if (System.Text.RegularExpressions.Regex.IsMatch(contentDisposition, @" *filename=", System.Text.RegularExpressions.RegexOptions.IgnoreCase)) {
+                                               contentDisposition = "attachment; " + contentDisposition;
+                                       }
+                                       
                                        try {
                                                ContentDisposition parser = new ContentDisposition(contentDisposition);
                                                if (! string.IsNullOrEmpty(parser.FileName)) {