Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API v1 returns 404 when requesting departures from stations with slashes in their name #895

Closed
jeriox opened this issue May 24, 2022 · 2 comments
Labels
APIv1 bug Something isn't working

Comments

@jeriox
Copy link

jeriox commented May 24, 2022

Describe the bug
When requesting the Departures of a station that contains slashes in its name via the v1 API, a 404 error is thrown. Replacing the slashes with spaces resolves the issue.

To Reproduce
Steps to reproduce the behavior:

  1. Request departures for a station with a slash in its name, e.g. "Luisenplatz-Süd/Park Sanssouci, Potsdam" (https://beta.traewelling.de/api/v1/trains/station/Luisenplatz-S%C3%BCd%2FPark%20Sanssouci,%20Potsdam/departures?when=2022-05-24T16:58:05.077869Z&travelType=)
  2. A 404 error is thrown
  3. Request the departures with spaces instead of slashes (https://beta.traewelling.de/api/v1/trains/station/Luisenplatz-S%C3%BCd%20Park%20Sanssouci,%20Potsdam/departures?when=2022-05-24T16:58:05.077869Z&travelType=)
  4. A result is delivered with the corresponding departures

Expected behavior
I expect the API to also deliver results for Stations with slashes

@jeriox jeriox added bug Something isn't working To Do labels May 24, 2022
@HerrLevin
Copy link
Member

Laravel does not support slashes in URL parameters and there are multiple issues to that wherein they explain that they won't fix this. (e.g. laravel/framework#22125)

There seems to be a workaround (laravel/framework#22125 (comment)) but this will break if there are more than one slashes in the url. In my opinion, a space instead of a slash would be the more consistent option but this needs to be documented.

// Origin Route
Route::get('/{query}', [\App\Http\Controllers\Front\User\CategoryController::class, 'category'])->name('category');
// Extra Route on the end of the route file:
Route::get('/{query}/{more?}', [\App\Http\Controllers\Front\User\CategoryController::class, 'category'])->name('category');

@HerrLevin
Copy link
Member

We were not able to fix this issue since it's the intended behavior of laravel. We've documented this in the API docs (https://traewelling.de/api/documentation#/Checkin/getDepartures) so I'll close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
APIv1 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants