Skip to content

Commit

Permalink
fix #217, 修复获取文件名错误
Browse files Browse the repository at this point in the history
  • Loading branch information
iikira committed Jun 8, 2018
1 parent 1dbcbc6 commit 56bf473
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pcsutil/addr.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
func ListAddresses() (addresses []string) {
ifaces, _ := net.Interfaces()
addresses = make([]string, 0, len(ifaces))
for k := range ifaces[:] {
for k := range ifaces {
ifAddrs, _ := ifaces[k].Addrs()
for l := range ifAddrs[:] {
for l := range ifAddrs {
switch v := ifAddrs[l].(type) {
case *net.IPNet:
addresses = append(addresses, v.IP.String())
Expand Down
4 changes: 3 additions & 1 deletion requester/downloader/utils.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package downloader

import (
"github.com/iikira/BaiduPCS-Go/pcsverbose"
"github.com/iikira/BaiduPCS-Go/requester"
mathrand "math/rand"
"mime"
Expand Down Expand Up @@ -35,7 +36,8 @@ func GetFileName(uri string, client *requester.HTTPClient) (filename string, err

_, params, err := mime.ParseMediaType(resp.Header.Get("Content-Disposition"))
if err != nil {
return "", err
pcsverbose.Verbosef("DEBUG: GetFileName ParseMediaType error: %s\n", err)
return path.Base(uri), nil
}

filename, err = url.QueryUnescape(params["filename"])
Expand Down

0 comments on commit 56bf473

Please sign in to comment.