Merge pull request #2 from mattn/handle-href
look href if displayname not exists thanks!
This commit is contained in:
		
						commit
						b12f1c1b33
					
				| @ -6,7 +6,9 @@ import ( | |||||||
| 	"encoding/xml" | 	"encoding/xml" | ||||||
| 	"io" | 	"io" | ||||||
| 	"net/http" | 	"net/http" | ||||||
|  | 	"net/url" | ||||||
| 	"os" | 	"os" | ||||||
|  | 	pathpkg "path" | ||||||
| 	"strings" | 	"strings" | ||||||
| 	"time" | 	"time" | ||||||
| ) | ) | ||||||
| @ -84,7 +86,11 @@ func (c *Client) ReadDir(path string) ([]os.FileInfo, error) { | |||||||
| 
 | 
 | ||||||
| 		if p := getProps(r, "200"); p != nil { | 		if p := getProps(r, "200"); p != nil { | ||||||
| 			f := new(File) | 			f := new(File) | ||||||
|  | 			if ps, err := url.QueryUnescape(r.Href); err == nil { | ||||||
|  | 				f.name = pathpkg.Base(ps) | ||||||
|  | 			} else { | ||||||
| 				f.name = p.Name | 				f.name = p.Name | ||||||
|  | 			} | ||||||
| 			f.path = path + f.name | 			f.path = path + f.name | ||||||
| 
 | 
 | ||||||
| 			if p.Type.Local == "collection" { | 			if p.Type.Local == "collection" { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user