MCPcopy Create free account
hub / github.com/imgproxy/imgproxy / getFallbackImage

Method getFallbackImage

handlers/processing/request_methods.go:127–147  ·  view source on GitHub ↗

getFallbackImage returns fallback image if any

()

Source from the content-addressed store, hash-verified

125
126// getFallbackImage returns fallback image if any
127func (r *request) getFallbackImage() (imagedata.ImageData, http.Header) {
128 fbi := r.FallbackImage()
129
130 if fbi == nil {
131 return nil, nil
132 }
133
134 data, h, err := fbi.Get(r.req.Context(), r.opts)
135 if err != nil {
136 //nolint:gosec
137 slog.Warn(err.Error())
138
139 if ierr := r.wrapDownloadingErr(err); ierr.ShouldReport() {
140 r.ErrorReporter().Report(ierr, r.req)
141 }
142
143 return nil, nil
144 }
145
146 return data, h
147}
148
149// processImage calls actual image processing
150func (r *request) processImage(

Callers 1

handleDownloadErrorMethod · 0.95

Calls 8

wrapDownloadingErrMethod · 0.95
WarnMethod · 0.80
FallbackImageMethod · 0.65
GetMethod · 0.65
ErrorMethod · 0.65
ShouldReportMethod · 0.65
ReportMethod · 0.65
ErrorReporterMethod · 0.65

Tested by

no test coverage detected