Skip to content

Commit

Permalink
fix: wrong file write bytes to correct this!
Browse files Browse the repository at this point in the history
  • Loading branch information
sigridjineth committed Nov 22, 2022
1 parent 2b0fe7e commit e3e384d
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions preprocess/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"github.com/labstack/echo"
_ "github.com/labstack/echo/v4"
"google.golang.org/grpc"
"io/ioutil"
"log"
"net/http"
"os"
Expand Down Expand Up @@ -150,14 +151,11 @@ func (s *S3Server) UploadRecording(_ context.Context, req *recordingpb.UploadRec
filename := fmt.Sprintf("%v.mp3", time.Now().Unix())
filepath := "/tmp/" + filename + ".mp3"

rec, err := os.Create(filepath)
err = ioutil.WriteFile(filepath, req.Recording, 0644)
if err != nil {
log.Println("Error creating file: ", err)
log.Println("Error writing to file: ", err)
return nil, err
}
defer rec.Close()

fmt.Fprintf(rec, string(req.Recording))

var response *recordingpb.UploadRecordingResponse
recording, err := info.UploadRecording(filename, filepath)
Expand Down

0 comments on commit e3e384d

Please sign in to comment.