This commit is contained in:
nemunaire 2022-10-23 16:45:11 +02:00
commit 5a5f81c0fb
3 changed files with 32 additions and 40 deletions

View file

@ -106,15 +106,7 @@ func getStations(code string) (stations []IDFMStation, err error) {
func declareStationsRoutes(router *gin.RouterGroup) {
router.GET("/stations/:type/:code", func(c *gin.Context) {
t := convertLineType(string(c.Param("type")))
code := string(c.Param("code"))
if !strings.HasPrefix(code, "line:IDFM:") {
if len(code) != 6 || !strings.HasPrefix(code, "C") {
code = searchLine(t, code)
}
code = "line:IDFM:" + code
}
code := convertCode(t, string(c.Param("code")))
stations, err := getStations(code)
if err != nil {