Skip to content

Commit

Permalink
⚡ (mix): Only parse preset during create of a stream
Browse files Browse the repository at this point in the history
  • Loading branch information
gabe565 committed May 19, 2023
1 parent 7116921 commit 2ebab51
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions internal/handlers/mix.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@ func Mix(app core.App) echo.HandlerFunc {
return apis.NewNotFoundError("", nil)
}

preset, err := preset.FromParam(presetEncoded)
if err != nil {
return apis.NewBadRequestError("", nil)
}

// File type parameter
var fileType filetype.FileType
err = fileType.UnmarshalText([]byte(fileTypeStr))
Expand Down Expand Up @@ -79,8 +74,13 @@ func Mix(app core.App) echo.HandlerFunc {
// Entry was not found
entry = stream_cache.NewEntry(remoteAddr, presetEncoded)

presetDecoded, err := preset.FromParam(presetEncoded)
if err != nil {
return apis.NewBadRequestError("", nil)
}

// Set up stream
if entry.Streams, err = stream.New(dataFs, app.Dao(), preset); err != nil {
if entry.Streams, err = stream.New(dataFs, app.Dao(), presetDecoded); err != nil {
if errors.Is(err, os.ErrNotExist) {
// Invalid file ID returns 404
return apis.NewNotFoundError("", nil)
Expand Down

0 comments on commit 2ebab51

Please sign in to comment.