mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-10-14 15:54:53 +08:00
issue 43 "go fmt" chagnes from "Ryan S. Brown" <sb@ryansb.com>
some basic changes to parse upload url
This commit is contained in:
@@ -6,19 +6,19 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func DeleteFile(server string, fileId string) (error) {
|
||||
func DeleteFile(server string, fileId string) error {
|
||||
fid, parseErr := storage.ParseFileId(fileId)
|
||||
if parseErr != nil {
|
||||
return parseErr
|
||||
}
|
||||
lookup, lookupError := Lookup(server,fid.VolumeId)
|
||||
lookup, lookupError := Lookup(server, fid.VolumeId)
|
||||
if lookupError != nil {
|
||||
return lookupError
|
||||
return lookupError
|
||||
}
|
||||
if len(lookup.Locations) == 0 {
|
||||
return nil
|
||||
return nil
|
||||
}
|
||||
return Delete("http://"+lookup.Locations[0].PublicUrl+"/"+fileId)
|
||||
return Delete("http://" + lookup.Locations[0].PublicUrl + "/" + fileId)
|
||||
}
|
||||
func Delete(url string) error {
|
||||
req, err := http.NewRequest("DELETE", url, nil)
|
||||
|
@@ -95,8 +95,8 @@ func (fi FilePart) Upload(server string, fid string) (int, error) {
|
||||
if fi.ModTime != 0 {
|
||||
fileUrl += "?ts=" + strconv.Itoa(int(fi.ModTime))
|
||||
}
|
||||
if closer, ok := fi.Reader.(io.Closer); ok{
|
||||
defer closer.Close()
|
||||
if closer, ok := fi.Reader.(io.Closer); ok {
|
||||
defer closer.Close()
|
||||
}
|
||||
ret, e := Upload(fileUrl, fi.FileName, fi.Reader, fi.IsGzipped, fi.MimeType)
|
||||
if e != nil {
|
||||
|
Reference in New Issue
Block a user