|
@ -3,6 +3,7 @@ package storage |
|
|
import ( |
|
|
import ( |
|
|
"encoding/hex" |
|
|
"encoding/hex" |
|
|
"errors" |
|
|
"errors" |
|
|
|
|
|
"fmt" |
|
|
"io/ioutil" |
|
|
"io/ioutil" |
|
|
"mime" |
|
|
"mime" |
|
|
"net/http" |
|
|
"net/http" |
|
@ -45,6 +46,11 @@ type Needle struct { |
|
|
Padding []byte `comment:"Aligned to 8 bytes"` |
|
|
Padding []byte `comment:"Aligned to 8 bytes"` |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (n *Needle) String() (str string) { |
|
|
|
|
|
str = fmt.Sprintf("Cookie:%d, Id:%d, Size:%d, DataSize:%d, Name: %s, Mime: %s", n.Cookie, n.Id, n.Size, n.DataSize, n.Name, n.Mime) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
func ParseUpload(r *http.Request) (fileName string, data []byte, mimeType string, isGzipped bool, modifiedTime uint64, ttl *TTL, e error) { |
|
|
func ParseUpload(r *http.Request) (fileName string, data []byte, mimeType string, isGzipped bool, modifiedTime uint64, ttl *TTL, e error) { |
|
|
form, fe := r.MultipartReader() |
|
|
form, fe := r.MultipartReader() |
|
|
if fe != nil { |
|
|
if fe != nil { |
|
|