aboutsummaryrefslogtreecommitdiffhomepage
path: root/resources
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2024-02-03 11:40:08 +0100
committerBjørn Erik Pedersen <[email protected]>2024-02-03 15:07:59 +0100
commite33a63255187bb4c5323e107b727e1d7b0117d19 (patch)
tree1f0b7942c54fbbcb2a442a2ac53bb00c748dd7e2 /resources
parent28733248983c1afc1e4e15dfc30fcf4c442e6ca4 (diff)
downloadhugo-e33a63255187bb4c5323e107b727e1d7b0117d19.tar.gz
hugo-e33a63255187bb4c5323e107b727e1d7b0117d19.zip
resources: Optimize reading resource Content when it's already a string
Diffstat (limited to 'resources')
-rw-r--r--resources/resource.go7
1 files changed, 1 insertions, 6 deletions
diff --git a/resources/resource.go b/resources/resource.go
index 6bef1b275..c11756bca 100644
--- a/resources/resource.go
+++ b/resources/resource.go
@@ -418,12 +418,7 @@ func (l *genericResource) Content(context.Context) (any, error) {
}
defer r.Close()
- var b []byte
- b, err = io.ReadAll(r)
- if err != nil {
- return "", err
- }
- return string(b), nil
+ return hugio.ReadString(r)
}
func (r *genericResource) Err() resource.ResourceError {