online-go / online-go.com

Source code for the Online-Go.com web interface
https://online-go.com/
GNU Affero General Public License v3.0
1.21k stars 338 forks source link

`/me` endpoint returning invalid links with missing `/` #2724

Open adamreisnz opened 3 weeks ago

adamreisnz commented 3 weeks ago

Describe the bug The /me endpoint is returning invalid links with a missing / in their paths.

To Reproduce

  1. Use the API
  2. Make a call to api/v1/me
  3. See malformed links with missing /, example: "/api/v1/mesettings"

Received JSON:

{
  "id": 1234,
  "username": "XXXXXX",
  "ratings": {
    "version": 5,
    "overall": {
      "rating": 1500,
      "deviation": 350,
      "volatility": 0.06
    }
  },
  "ranking": 24.303382182144386,
  "about": "",
  "settings": "/api/v1/mesettings",
  "account_settings": "/api/v1/meaccount_settings",
  "friends": "/api/v1/mefriends",
  "games": "/api/v1/megames",
  "challenges": "/api/v1/mechallenges",
  "groups": "/api/v1/megroups",
  "tournaments": "/api/v1/metournaments",
  "vacation": "/api/v1/mevacation",
  "notifications": "/api/v1/menotifications"
}

Expected behavior Valid paths with / after /me, e.g. "/api/v1/me/settings"

Expected JSON:

{
  "id": 1234,
  "username": "XXXXXX",
  "ratings": {
    "version": 5,
    "overall": {
      "rating": 1500,
      "deviation": 350,
      "volatility": 0.06
    }
  },
  "ranking": 24.303382182144386,
  "about": "",
  "settings": "/api/v1/me/settings",
  "account_settings": "/api/v1/me/account_settings",
  "friends": "/api/v1/me/friends",
  "games": "/api/v1/me/games",
  "challenges": "/api/v1/me/challenges",
  "groups": "/api/v1/me/groups",
  "tournaments": "/api/v1/me/tournaments",
  "vacation": "/api/v1/me/vacation",
  "notifications": "/api/v1/me/notifications"
}

Desktop (please complete the following information): n/a

Smartphone (please complete the following information): n/a

Additional context This was on beta.online-go.com

anoek commented 3 weeks ago

Whoops