Skip to content

Commit

Permalink
fixed lint
Browse files Browse the repository at this point in the history
  • Loading branch information
justkhbby committed Aug 6, 2024
1 parent 0bac546 commit bc4d843
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func main() {
// Load the .env file
err = godotenv.Load(".env")
if err != nil {
slog.Warn("Error loading .env file: %s", err)
slog.Warn("Error loading .env file", "err", err)
}

postgresqlDB := store.PostgreSQL{}
Expand Down
10 changes: 8 additions & 2 deletions packages/honeypot/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,19 @@ func (h *httpHoneypot) Start() error {
"status": "error",
"message": "No input provided. Please send PHP code to execute.",
}
json.NewEncoder(w).Encode(response)
if err := json.NewEncoder(w).Encode(response); err != nil {
http.Error(w, "Failed to encode response", http.StatusInternalServerError)
return
}
} else if r.Method == http.MethodPost || r.Method == http.MethodPut {
response := map[string]interface{}{
"status": "error",
"message": "Error executing code: syntax error, unexpected end of file",
}
json.NewEncoder(w).Encode(response)
if err := json.NewEncoder(w).Encode(response); err != nil {
http.Error(w, "Failed to encode response", http.StatusInternalServerError)
return
}
}
})

Expand Down

0 comments on commit bc4d843

Please sign in to comment.