File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -174,6 +174,8 @@ func contextNamespace(c context.Context) string {
174174 return c .Value (& contextKeyNamespace ).(string )
175175}
176176
177+ // gcsPayloadHandler json.Decode the gcsURL from payload and stream pointed content.
178+ // This function streams ungzipped content in order to be aligned with other wrappers/handlers.
177179func gcsPayloadHandler (handler APIHandler ) APIHandler {
178180 return func (c context.Context , payload io.Reader ) (interface {}, error ) {
179181 var gcsURL string
@@ -194,7 +196,15 @@ func gcsPayloadHandler(handler APIHandler) APIHandler {
194196 if err != nil {
195197 return nil , fmt .Errorf ("gcsFile.Reader: %w" , err )
196198 }
197- return handler (c , gcsPayloadReader )
199+ gz , err := gzip .NewReader (gcsPayloadReader )
200+ if err != nil {
201+ return nil , fmt .Errorf ("gzip.NewReader: %w" , err )
202+ }
203+ // Close() generates error in case of the corrupted data.
204+ // In order to check the data checksum all the data should be read.
205+ // We don't guarantee all the data will be read - let's ignore.
206+ defer gz .Close ()
207+ return handler (c , gz )
198208 }
199209}
200210
You can’t perform that action at this time.
0 commit comments