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

Inconsistent case handling for non lowercase system_ids #427

Closed
hbruch opened this issue Apr 15, 2024 · 9 comments · Fixed by #455
Closed

Inconsistent case handling for non lowercase system_ids #427

hbruch opened this issue Apr 15, 2024 · 9 comments · Fixed by #455
Labels
bug Something isn't working

Comments

@hbruch
Copy link
Collaborator

hbruch commented Apr 15, 2024

Expected behavior

Either lamassu should enforce lowercase system_ids in feedproviders.yml, or it should not lowercase the system_id when publishing feed urls.

Observed behavior

We configured a provider using it's original mixed case system_id (e.g. provider_TOWN).

Lamassu publishes this feed in http://lamassu:8080/gbfs as http://lamassu:8080/gbfs/provider_town/gbfs, which results in a 404 error when requested. http://lamassu:8080/gbfs/provider_TOWN/gbfs works.

Version of lamassu used (exact commit hash or JAR name)

8cff0c8

Data sets in use (links to GBFS feeds)

any

Steps to reproduce the problem

Configure e.g.

lamassu:
  providers:
    - systemId: provider_TOWN
      operatorId: op:Operator:p
      operatorName: Provider
      codespace: op
      url: "https://provider.com/gbfs.json"
      language: en

http://localhost:8080/gbfs will respond with:

{"systems":[{"id":"provider_TOWN","url":"http://localhost:8080/gbfs/provider_town/gbfs"}
@testower
Copy link
Collaborator

That's surprising. I can't recall having made a conscious decision to lowercase URLs and I can't find any code path that does it.

@testower testower added the bug Something isn't working label Apr 15, 2024
@testower testower added this to the 1.1 (next release) milestone Apr 15, 2024
@testower
Copy link
Collaborator

@hbruch Are you able to work on this?

@hbruch
Copy link
Collaborator Author

hbruch commented Apr 19, 2024

This issue can be worked around using lowercase system IDs. I'll look into this after another issue we see currently.

@hbruch
Copy link
Collaborator Author

hbruch commented Apr 20, 2024

Seems like FeedUrlUtil#L36 is the culprit lowercasing the system_id.

Looking into the commit history, it seems as it has been like this for a long time already. I suppose, that usually only lowercase system_ids have been used. Would you nevertheless support removing the lowercasing? If yes, I'd prepare a PR.

@testower
Copy link
Collaborator

Is it URI.create()? I'm pretty sure String.format with %s preserves the case.

That aside, yes lowercasing was never my intention, feel free to open a PR for this :)

@hbruch
Copy link
Collaborator Author

hbruch commented Apr 20, 2024

I'd just remove the toLowercase() call.

@testower
Copy link
Collaborator

I'd just remove the toLowercase() call.

Wow, I can't believe I missed that 🗡️ . Well, I guess I must have put it there, but I can't think of any reason why it should be so. So I vote to remove it.

@testower
Copy link
Collaborator

Oh wait, the lowercasing is there for the feed names!

@testower
Copy link
Collaborator

That must be a remnant of the past, the enum values are already lowercased. Remove it :)

@testower testower linked a pull request May 15, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants