mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-20 21:31:32 +02:00
Add fill HTTP Response info into .Data in resources.GetRemote
See #10604
This commit is contained in:
@@ -192,6 +192,7 @@ func (r *Spec) newGenericResource(sourceFs afero.Fs,
|
||||
sourceFilename,
|
||||
baseFilename,
|
||||
mediaType,
|
||||
nil,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -203,7 +204,9 @@ func (r *Spec) newGenericResourceWithBase(
|
||||
osFileInfo os.FileInfo,
|
||||
sourceFilename,
|
||||
baseFilename string,
|
||||
mediaType media.Type) *genericResource {
|
||||
mediaType media.Type,
|
||||
data map[string]any,
|
||||
) *genericResource {
|
||||
if osFileInfo != nil && osFileInfo.IsDir() {
|
||||
panic(fmt.Sprintf("dirs not supported resource types: %v", osFileInfo))
|
||||
}
|
||||
@@ -244,6 +247,7 @@ func (r *Spec) newGenericResourceWithBase(
|
||||
name: baseFilename,
|
||||
title: baseFilename,
|
||||
resourceContent: &resourceContent{},
|
||||
data: data,
|
||||
}
|
||||
|
||||
return g
|
||||
@@ -305,7 +309,8 @@ func (r *Spec) newResource(sourceFs afero.Fs, fd ResourceSourceDescriptor) (reso
|
||||
fi,
|
||||
sourceFilename,
|
||||
fd.RelTargetFilename,
|
||||
mimeType)
|
||||
mimeType,
|
||||
fd.Data)
|
||||
|
||||
if mimeType.MainType == "image" {
|
||||
imgFormat, ok := images.ImageFormatFromMediaSubType(mimeType.SubType)
|
||||
|
Reference in New Issue
Block a user