Skip to content

Commit

Permalink
- optimize
Browse files Browse the repository at this point in the history
  • Loading branch information
KinNeko-De committed Dec 20, 2023
1 parent d84550d commit 70e9085
Show file tree
Hide file tree
Showing 3 changed files with 530 additions and 19 deletions.
8 changes: 4 additions & 4 deletions internal/app/file/file_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ func (s *FileServiceServer) StoreFile(stream apiRestaurantFile.FileService_Store
}
}

n := 512
if size < uint64(n) {
n = int(size)
sniffByteCount := size
if sniffByteCount > 512 {
sniffByteCount = 512
}
contentType := http.DetectContentType(sniff[:n])
contentType := http.DetectContentType(sniff[:sniffByteCount])

fileUuid, err := apiProtobuf.ToProtobuf(fileId)
if err != nil {
Expand Down
1 change: 0 additions & 1 deletion internal/app/file/file_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ func TestFile(t *testing.T) {
output, _ := os.Create("test.txt")
output.WriteString(variable)
output.Close()

}

func TestStoreFile_TextFile(t *testing.T) {
Expand Down
Loading

0 comments on commit 70e9085

Please sign in to comment.