Repository: gohugoio/hugo (language: go)

Issue:
Handle error resource passed to resources.Copy
https://discourse.gohugo.io/t/one-time-build-error-on-cloudflare-pages/39062


Discussion / hints:

Fix patch:
diff --git a/resources/resource.go b/resources/resource.go
index 5773977a26b..fd60fd4f6e1 100644
--- a/resources/resource.go
+++ b/resources/resource.go
@@ -128,6 +128,9 @@ type resourceCopier interface {
 
 // Copy copies r to the targetPath given.
 func Copy(r resource.Resource, targetPath string) resource.Resource {
+	if r.Err() != nil {
+		panic(fmt.Sprintf("Resource has an .Err: %s", r.Err()))
+	}
 	return r.(resourceCopier).cloneTo(targetPath)
 }
 


Test patch: