Skip to content

Commit

Permalink
move string trimming to relevant function
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulSonOfLars committed Nov 4, 2023
1 parent 823938c commit f7e28f4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ext/botmapping.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func (m *botMapping) getBotFromURL(urlPath string) (botData, bool) {
m.mux.RLock()
defer m.mux.RUnlock()

token, ok := m.urlMapping[strings.TrimPrefix(urlPath, "/")]
token, ok := m.urlMapping[urlPath]
if !ok {
return botData{}, ok
}
Expand All @@ -144,7 +144,7 @@ func (m *botMapping) ServeHTTP(w http.ResponseWriter, r *http.Request) {
return
}

b, ok := m.getBotFromURL(r.URL.Path)
b, ok := m.getBotFromURL(strings.TrimPrefix(r.URL.Path, "/"))
if !ok {
// If we don't recognise the URL, we return a 404.
w.WriteHeader(http.StatusNotFound)
Expand Down

0 comments on commit f7e28f4

Please sign in to comment.