Skip to content

Commit

Permalink
Merge pull request #3748 from kobergj/UnmarshalPPEvents
Browse files Browse the repository at this point in the history
[tests-only] Unmarshal PP events correctly
  • Loading branch information
kobergj authored Mar 24, 2023
2 parents aa41afd + bf61e67 commit ec9d381
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions changelog/unreleased/unmarshal-pp-events.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Bugfix: Prevent service from panicking

Changelog is unneccessary

https://github.com/cs3org/reva/pull/3748
13 changes: 13 additions & 0 deletions pkg/events/postprocessing.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,19 @@ type PostprocessingStepFinished struct {
func (PostprocessingStepFinished) Unmarshal(v []byte) (interface{}, error) {
e := PostprocessingStepFinished{}
err := json.Unmarshal(v, &e)
if err != nil {
return nil, err
}

switch e.FinishedStep {
case PPStepAntivirus:
var res VirusscanResult
b, _ := json.Marshal(e.Result)
err = json.Unmarshal(b, &res)
e.Result = res
case PPStepPolicies:
// nothing to do, but this makes the linter happy
}
return e, err
}

Expand Down

0 comments on commit ec9d381

Please sign in to comment.