Skip to content

Commit

Permalink
strip port
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Byrne authored and Michael Byrne committed Apr 16, 2024
1 parent 2331487 commit 7406de4
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions app/internal/transport/handlers/threads/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,11 @@ func (h *Handler) CreateThread(w http.ResponseWriter, r *http.Request) {
ip = "127.0.0.1"
}

splitIP := strings.Split(ip, ":")
if len(splitIP) > 1 {
ip = splitIP[0]
}

threadID, err := h.threadService.NewThread(member.Username, ip, body, subject)
if err != nil {
w.WriteHeader(http.StatusInternalServerError)
Expand Down Expand Up @@ -445,6 +450,11 @@ func (h *Handler) Post(w http.ResponseWriter, r *http.Request) {
ip = "127.0.0.1"
}

splitIP := strings.Split(ip, ":")
if len(splitIP) > 1 {
ip = splitIP[0]
}

_, err = h.threadService.NewPost(body, ip, member.Username, threadIDInt)
if err != nil {
w.WriteHeader(http.StatusInternalServerError)
Expand Down

0 comments on commit 7406de4

Please sign in to comment.