mirror of
https://github.com/danderson/netboot.git
synced 2025-10-15 17:41:38 +02:00
pixiecore: return file size on apibooter version of ReadBootFile (#14)
Otherwise Content-Length header cannot be properly set, and this causes issues with iPXE.
This commit is contained in:
parent
d1e0ba49c4
commit
57a1c9bea2
@ -254,7 +254,16 @@ func (b *apibooter) ReadBootFile(id ID) (io.ReadCloser, int64, error) {
|
||||
)
|
||||
if u.Scheme == "file" {
|
||||
// TODO serveFile
|
||||
ret, err = os.Open(u.Path)
|
||||
f, err := os.Open(u.Path)
|
||||
if err != nil {
|
||||
return nil, -1, err
|
||||
}
|
||||
fi, err := f.Stat()
|
||||
if err != nil {
|
||||
f.Close()
|
||||
return nil, -1, err
|
||||
}
|
||||
ret, sz = f, fi.Size()
|
||||
} else {
|
||||
// urlStr will get reparsed by http.Get, which is mildly
|
||||
// wasteful, but the code looks nicer than constructing a
|
||||
|
Loading…
x
Reference in New Issue
Block a user