mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
"weed upload" return message changes
This commit is contained in:
parent
4c1bc99366
commit
b0e5112702
|
@ -67,11 +67,11 @@ func upload(filename string, server string, fid string) (int, error) {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
fi, fiErr := fh.Stat()
|
fi, fiErr := fh.Stat()
|
||||||
if fiErr!=nil {
|
if fiErr != nil {
|
||||||
debug("Failed to stat file:", filename)
|
debug("Failed to stat file:", filename)
|
||||||
return 0, fiErr
|
return 0, fiErr
|
||||||
}
|
}
|
||||||
ret, e := operation.Upload("http://"+server+"/"+fid+"?ts="+strconv.Itoa(int(fi.ModTime().Unix()) ), path.Base(filename), fh)
|
ret, e := operation.Upload("http://"+server+"/"+fid+"?ts="+strconv.Itoa(int(fi.ModTime().Unix())), path.Base(filename), fh)
|
||||||
if e != nil {
|
if e != nil {
|
||||||
return 0, e
|
return 0, e
|
||||||
}
|
}
|
||||||
|
@ -79,6 +79,8 @@ func upload(filename string, server string, fid string) (int, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
type SubmitResult struct {
|
type SubmitResult struct {
|
||||||
|
FileName string `json:"fileName"`
|
||||||
|
FileUrl string `json:"fileUrl"`
|
||||||
Fid string `json:"fid"`
|
Fid string `json:"fid"`
|
||||||
Size int `json:"size"`
|
Size int `json:"size"`
|
||||||
Error string `json:"error"`
|
Error string `json:"error"`
|
||||||
|
@ -101,13 +103,14 @@ func submit(files []string) []SubmitResult {
|
||||||
fid = ""
|
fid = ""
|
||||||
results[index].Error = err.Error()
|
results[index].Error = err.Error()
|
||||||
}
|
}
|
||||||
|
results[index].FileName = file
|
||||||
results[index].Fid = fid
|
results[index].Fid = fid
|
||||||
|
results[index].FileUrl = ret.PublicUrl + "/" + fid
|
||||||
}
|
}
|
||||||
return results
|
return results
|
||||||
}
|
}
|
||||||
|
|
||||||
func runUpload(cmd *Command, args []string) bool {
|
func runUpload(cmd *Command, args []string) bool {
|
||||||
*IsDebug = true
|
|
||||||
if len(cmdUpload.Flag.Args()) == 0 {
|
if len(cmdUpload.Flag.Args()) == 0 {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
|
@ -213,6 +213,6 @@ func writeJsonQuiet(w http.ResponseWriter, r *http.Request, obj interface{}) {
|
||||||
|
|
||||||
func debug(params ...interface{}) {
|
func debug(params ...interface{}) {
|
||||||
if *IsDebug {
|
if *IsDebug {
|
||||||
fmt.Println(params)
|
log.Println(params)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue