OSDN Git Service

na-get-lib,ファイルダウンロードで attachment;filename= のようにセミコロン後にスペースがない場合の対応
authorttp <ttp@users.sourceforge.jp>
Sat, 21 Jan 2017 14:59:30 +0000 (23:59 +0900)
committerttp <ttp@users.sourceforge.jp>
Sat, 21 Jan 2017 14:59:30 +0000 (23:59 +0900)
na-get-lib/NaGet.SubCommands.SubTask/DownloadSubTask.cs

index 48dd8e2..74cd2a9 100644 (file)
@@ -356,6 +356,10 @@ namespace NaGet.SubCommands.SubTask
                                        if (System.Text.RegularExpressions.Regex.IsMatch(contentDisposition, @" *filename=", System.Text.RegularExpressions.RegexOptions.IgnoreCase)) {
                                                contentDisposition = "attachment; " + contentDisposition;
                                        }
+                                       // "atachment;filename=\""のようにセミコロンの後ろにスペースがない場合、それを補充する
+                                       if (System.Text.RegularExpressions.Regex.IsMatch(contentDisposition, @";[^ ]", System.Text.RegularExpressions.RegexOptions.IgnoreCase)) {
+                                               contentDisposition = string.Join("; ", System.Text.RegularExpressions.Regex.Split(contentDisposition, @"; *"));
+                                       }
                                        
                                        try {
                                                ContentDisposition parser = new ContentDisposition(contentDisposition);