diff options
author | Bjørn Erik Pedersen <[email protected]> | 2024-02-03 11:40:08 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2024-02-03 15:07:59 +0100 |
commit | e33a63255187bb4c5323e107b727e1d7b0117d19 (patch) | |
tree | 1f0b7942c54fbbcb2a442a2ac53bb00c748dd7e2 /resources | |
parent | 28733248983c1afc1e4e15dfc30fcf4c442e6ca4 (diff) | |
download | hugo-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.go | 7 |
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 { |