Skip to content

Commit

Permalink
lxd/instance/file: Add type and size to HEAD
Browse files Browse the repository at this point in the history
Signed-off-by: Stéphane Graber <[email protected]>
(cherry picked from commit e6a9eaefd41c3768b07468453c8c2e1bdc5f130b)
Signed-off-by: Kadin Sayani <[email protected]>
License: Apache-2.0
  • Loading branch information
stgraber authored and kadinsayani committed Aug 9, 2024
1 parent f69ab6c commit a56285d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lxd/instance_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,11 @@ func instanceFileHead(inst instance.Instance, path string) response.Response {
"X-LXD-type": fileType,
}

if fileType == "file" {
headers["Content-Type"] = "application/octet-stream"
headers["Content-Length"] = fmt.Sprintf("%d", stat.Size())
}

// Return an empty body (per RFC for HEAD).
return response.ManualResponse(func(w http.ResponseWriter) error {
// Set the headers.
Expand Down

0 comments on commit a56285d

Please sign in to comment.