|
@ -4,7 +4,6 @@ import ( |
|
|
"encoding/hex" |
|
|
"encoding/hex" |
|
|
"io" |
|
|
"io" |
|
|
"io/ioutil" |
|
|
"io/ioutil" |
|
|
"log" |
|
|
|
|
|
"mime" |
|
|
"mime" |
|
|
"net/http" |
|
|
"net/http" |
|
|
"os" |
|
|
"os" |
|
@ -27,7 +26,7 @@ func NewNeedle(r *http.Request) (n *Needle, e error) { |
|
|
n = new(Needle) |
|
|
n = new(Needle) |
|
|
form, fe := r.MultipartReader() |
|
|
form, fe := r.MultipartReader() |
|
|
if fe != nil { |
|
|
if fe != nil { |
|
|
log.Printf("MultipartReader [ERROR] %s\n", fe) |
|
|
|
|
|
|
|
|
println("MultipartReader [ERROR]", fe) |
|
|
e = fe |
|
|
e = fe |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
@ -60,7 +59,7 @@ func (n *Needle) ParsePath(fid string) { |
|
|
length := len(fid) |
|
|
length := len(fid) |
|
|
if length <= 8 { |
|
|
if length <= 8 { |
|
|
if length > 0 { |
|
|
if length > 0 { |
|
|
log.Println("Invalid fid", fid, "length", length) |
|
|
|
|
|
|
|
|
println("Invalid fid", fid, "length", length) |
|
|
} |
|
|
} |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
@ -118,7 +117,7 @@ func ParseKeyHash(key_hash_string string) (uint64, uint32) { |
|
|
key_hash_bytes, khe := hex.DecodeString(key_hash_string) |
|
|
key_hash_bytes, khe := hex.DecodeString(key_hash_string) |
|
|
key_hash_len := len(key_hash_bytes) |
|
|
key_hash_len := len(key_hash_bytes) |
|
|
if khe != nil || key_hash_len <= 4 { |
|
|
if khe != nil || key_hash_len <= 4 { |
|
|
log.Println("Invalid key_hash", key_hash_string, "length:", key_hash_len, "error", khe) |
|
|
|
|
|
|
|
|
println("Invalid key_hash", key_hash_string, "length:", key_hash_len, "error", khe) |
|
|
return 0, 0 |
|
|
return 0, 0 |
|
|
} |
|
|
} |
|
|
key := util.BytesToUint64(key_hash_bytes[0 : key_hash_len-4]) |
|
|
key := util.BytesToUint64(key_hash_bytes[0 : key_hash_len-4]) |
|
|