Skip to content

Commit

Permalink
refactor: simplify media file JSON marshal
Browse files Browse the repository at this point in the history
  • Loading branch information
tympanix committed Jun 28, 2018
1 parent 2cbe324 commit 75fe11b
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions media/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package media

import (
"encoding/json"
"errors"
"os"

"github.com/tympanix/supper/types"
Expand All @@ -17,10 +16,7 @@ type File struct {

// MarshalJSON returns the JSON represnetation of a media file
func (f *File) MarshalJSON() (b []byte, err error) {
if js, ok := f.Media.(json.Marshaler); ok {
return js.MarshalJSON()
}
return nil, errors.New("media could not be json encoded")
return json.Marshal(f.Media)
}

// String returns a string representation of the media in the file
Expand Down

0 comments on commit 75fe11b

Please sign in to comment.