forked from mirror/pkger
windows are broken
This commit is contained in:
parent
0f102bc1e8
commit
1d23c6b87b
9
file.go
9
file.go
|
@ -5,6 +5,7 @@ import (
|
|||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
"time"
|
||||
|
@ -29,6 +30,14 @@ func (f File) MarshalJSON() ([]byte, error) {
|
|||
m["her"] = f.her
|
||||
m["path"] = f.path
|
||||
m["index"] = f.index
|
||||
m["data"] = f.data
|
||||
if len(f.data) == 0 {
|
||||
b, err := ioutil.ReadAll(&f)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
m["data"] = b
|
||||
}
|
||||
return json.Marshal(m)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue