diff --git a/src/github.com/matrix-org/dendrite/clientapi/writers/room_directory.go b/src/github.com/matrix-org/dendrite/clientapi/writers/room_directory.go index a40e8a288..8298fec9c 100644 --- a/src/github.com/matrix-org/dendrite/clientapi/writers/room_directory.go +++ b/src/github.com/matrix-org/dendrite/clientapi/writers/room_directory.go @@ -89,6 +89,8 @@ func GetPublicRooms( } } +// fillPublicRoomsReq fills the Limit, Since and Filter attributes of a request to the roomserver's +// GetPublicRooms API by parsing the incoming HTTP request func fillPublicRoomsReq(httpReq *http.Request, queryReq *api.GetPublicRoomsRequest) *util.JSONResponse { if httpReq.Method == "GET" { limit, err := strconv.Atoi(httpReq.FormValue("limit")) diff --git a/src/github.com/matrix-org/dendrite/roomserver/publicroom/public_room.go b/src/github.com/matrix-org/dendrite/roomserver/publicroom/public_room.go index 1598d2efc..7045c367b 100644 --- a/src/github.com/matrix-org/dendrite/roomserver/publicroom/public_room.go +++ b/src/github.com/matrix-org/dendrite/roomserver/publicroom/public_room.go @@ -113,13 +113,12 @@ func (r *RoomserverPublicRoomAPI) GetPublicRooms( var offset int64 limit = req.Limit - ofst, err := strconv.Atoi(req.Since) - // Atoi returns 0 and an error when trying to parse an empty string + offset, err := strconv.ParseInt(req.Since, 10, 64) + // ParseInt returns 0 and an error when trying to parse an empty string // In that case, we want to assign 0 so we ignore the error if err != nil && len(req.Since) > 0 { return err } - offset = int64(ofst) roomIDs, err := r.DB.GetPublicRoomIDs() if err != nil {