Skip to content

Commit

Permalink
refactor: code format
Browse files Browse the repository at this point in the history
  • Loading branch information
Caixetadev committed Jan 25, 2024
1 parent 690f83f commit e181123
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/handlers/docs/handleAllDocs.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (

func HandleAllDocs(c *gin.Context) {
var entries []models.Doc

database.DB.Find(&entries, &models.Doc{})

c.JSON(http.StatusOK, entries)

}
2 changes: 1 addition & 1 deletion src/handlers/image/handleAllImages.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (

func HandleAllImages(c *gin.Context) {
var entries []models.Image

database.DB.Find(&entries, &models.Image{})

c.JSON(http.StatusOK, entries)

}
4 changes: 1 addition & 3 deletions src/handlers/image/handleImageUpload.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import (
)

func HandleImageUpload(c *gin.Context) {
fileHeader, err := c.FormFile("image")
newName := c.PostForm("filename")

fileHeader, err := c.FormFile("image")
if err != nil {
c.String(http.StatusBadRequest, "Failed to read file: %s", err.Error())
return
Expand Down Expand Up @@ -53,7 +53,6 @@ func HandleImageUpload(c *gin.Context) {
var filename string

if newName == "" {

filename = fileHeader.Filename
} else {
filename = newName + filepath.Ext(fileHeader.Filename)
Expand All @@ -62,7 +61,6 @@ func HandleImageUpload(c *gin.Context) {
savedFilename, alreadyExists := database.AddImage(filename, fileHashBuffer[:])

filteredFilename, err := util.FilterFilename(filename)

if err != nil {
c.String(http.StatusBadRequest, err.Error())
return
Expand Down

0 comments on commit e181123

Please sign in to comment.