|
|
@@ -117,7 +117,8 @@ func DownFile(l *logrus.Logger, urlStr string, _proxySettings ...*settings.Proxy
|
|
|
func GetFileName(l *logrus.Logger, resp *http.Response) string {
|
|
|
contentDisposition := resp.Header.Get("Content-Disposition")
|
|
|
if len(contentDisposition) == 0 {
|
|
|
- return ""
|
|
|
+ m := regexp.MustCompile(`^(.*/)?(?:$|(.+?)(?:(\.[^.]*$)|$))`).FindStringSubmatch(resp.Request.URL.String())
|
|
|
+ return m[2]+m[3]
|
|
|
}
|
|
|
re := regexp.MustCompile(`filename=["]*([^"]+)["]*`)
|
|
|
matched := re.FindStringSubmatch(contentDisposition)
|