windows are broken

This commit is contained in:
Mark Bates 2019-07-31 13:58:20 -04:00
parent 0f102bc1e8
commit 1d23c6b87b
1 changed files with 9 additions and 0 deletions

View File

@ -5,6 +5,7 @@ import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"io" "io"
"io/ioutil"
"net/http" "net/http"
"os" "os"
"time" "time"
@ -29,6 +30,14 @@ func (f File) MarshalJSON() ([]byte, error) {
m["her"] = f.her m["her"] = f.her
m["path"] = f.path m["path"] = f.path
m["index"] = f.index 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) return json.Marshal(m)
} }