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 73806a8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Recording S3 upload dedicated Microservice to deliverble restful server
* only [deliverble restful server](https://github.com/DeliverBle/deliverble-backend-nestjs) is allowed to communicate with the MSA module
### does not
* provide any other functionality other than uploading mp3 file in s3 bucket
* delete feature or change naming strategy should be done in the restful server (nothing to do with bucket itself)
* delete feature, change naming feature or listing all recordings by User Identity should be done in the restful server (nothing to do with bucket itself)

## How to start
```
Expand Down
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 73806a8

Please sign in to comment.