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

trip-details is failing for certain trip IDs #111

Closed
wants to merge 1 commit into from

Conversation

icecrystal23
Copy link

TLDR version
I am not sure that this is really the "correct" or "best" fix for this, but I have created the pull request in order to demonstrate where I believe the issue is and one possible solution for it. See the full details for potentially better solutions.

The issue is that the iPhone app is generating the following URL when you try to view trip details for route 512 in the Puget Sound, which is returning nothing and causing the app to display an error. The URL being generated is:
http://api.pugetsound.onebusaway.org/api/where/trip-details/29_14SEP-Weekday-510%2F512n-71.json?key=TEST&app_uid=A0684229-8411-487E-91F6-08EE2E413755&app_ver=1f56f03+&version=2&serviceDate=1421136000000&vehicleId=

The trip ID here is really "29_14SEP-Weekday-510/512n-71", but the "/" character has been URL encoded in the request.

I believe if the trip ID is simply decoded, then the response to the above URL should work.

Full issue details
A better solution might be to pre-process all properties being sent to ApiActionSupport instances to ensure that they are not URL encoded, however I am not familiar with the classes being used so it would take me much longer to implement this solution.

Another better solution might be to update the transit-data-federation-builder so that it filters out these potentially problematic characters in trip IDs.

Sound Transit route 512 has not been working on my iPhone. I tried telling OneBusAway, but they didn't resolve the issue quickly enough for my liking so I decided to try and debug and fix the issue myself.

I tried spinning up my own web-server and ran the app in the simulator, but I couldn't reproduce the issue with the data I had (I downloaded the GTFS data from Sound Transit directly, generated a transit data bundle, started my server, pointed OneBusAway on the simulator to my server, and its route 512 works fine).

Then it occurred to me that the issue seemed specific to the API call being made for route 512 when pointing to the production API servers. So I looked at it in more detail and determined that the issue could be the "/" in the trip ID.

API repro
Hit this URL:
http://api.pugetsound.onebusaway.org/api/where/trip-details/29_14SEP-Weekday-510%2F512n-71.json?key=TEST&app_uid=A0684229-8411-487E-91F6-08EE2E413755&app_ver=1f56f03+&version=2&serviceDate=1421136000000&vehicleId=

Expected result:
You get some JSON data back with the trip details

Actual result:
You get nothing.

App Repro
Install the App Store version of the OneBusAway app on an iPhone
Go to the Puget Sound region
Search for route 512
Choose any stop on the route and go to the stop details
Choose a 511 or 512 trip and go to the trip details
Try to "Show as map" or "Show on list"

Expected:
You see the 512 route or list

Actual:
View title is "Error connecting" and the view shows "Loading..." forever

@onebusawaybot
Copy link

Can one of the admins verify this patch?

@sheldonabrown
Copy link
Member

Thanks Tracy, this is awesome work.

I've filed issue
#112 to
represent this.

In that issue, you'll see I agree there are better ways to solve this. I'm
wondering if perhaps a simple mod script would solve the problem as
documented here:

http://developer.onebusaway.org/modules/onebusaway-gtfs-modules/1.3.4-SNAPSHOT/onebusaway-gtfs-transformer-cli.html

I'll try some configuration on the next bundle build and see what I can
come up with.

On Wed, Jan 14, 2015 at 2:10 AM, onebusaway builder bot <
notifications@github.com> wrote:

Can one of the admins verify this patch?


Reply to this email directly or view it on GitHub
#111 (comment)
.

@icecrystal23
Copy link
Author

Great, thanks! I will keep an eye on #112

sheldonabrown added a commit that referenced this pull request Jan 1, 2024
…-MTA-order

Added RouteSort configurable class and Implementation.
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.

3 participants