mirror of
https://github.com/danderson/netboot.git
synced 2025-10-16 01:51:19 +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" {
|
if u.Scheme == "file" {
|
||||||
// TODO serveFile
|
// 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 {
|
} else {
|
||||||
// urlStr will get reparsed by http.Get, which is mildly
|
// urlStr will get reparsed by http.Get, which is mildly
|
||||||
// wasteful, but the code looks nicer than constructing a
|
// wasteful, but the code looks nicer than constructing a
|
||||||
|
Loading…
x
Reference in New Issue
Block a user