Skip to content

Fix: problem fetching datasets with type 1 authentication. #1292

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

Merged
merged 1 commit into from
Jul 21, 2025

Conversation

jcpitre
Copy link
Collaborator

@jcpitre jcpitre commented Jul 17, 2025

Summary:

Datasets were not downloaded for mdb-2684.
mdb-2684 has type 1 authentication, meaning the token is passed as a query in the URL.
The base URL for this feed is: http://api.511.org/transit/datafeeds?operator_id=CE
The code would just append ?api_key=... to the base url, giving a resulting url with two ?
The correction is to use the & separator if the URL already has a ?.

Note this could fix other feeds with the same configuration.

Please make sure these boxes are checked before submitting your pull request - thanks!

  • Run the unit tests with ./scripts/api-tests.sh to make sure you didn't break anything
  • Add or update any needed documentation to the repo
  • Format the title like "feat: [new feature short description]". Title must follow the Conventional Commit Specification(https://www.conventionalcommits.org/en/v1.0.0/).
  • Linked all relevant issues
  • Include screenshot(s) showing how this pull request works and fixes the issue(s)

@jcpitre jcpitre requested a review from Copilot July 17, 2025 22:18
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a bug in URL construction for datasets using type 1 authentication where the API key is passed as a query parameter. The issue occurred when the base URL already contained query parameters, causing malformed URLs with duplicate ? characters.

  • Updates URL construction logic to properly handle existing query parameters
  • Adds logic to detect existing query strings and use appropriate separator (& vs ?)
  • Includes explanatory comments documenting the edge case

@jcpitre jcpitre merged commit fb797f9 into main Jul 21, 2025
3 checks passed
@jcpitre jcpitre deleted the download-dataset-broken-for-type1-auth branch July 21, 2025 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants