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

Google Reader API: item ids base10 vs base16 #1498

Closed
lwindolf opened this issue Jul 17, 2022 · 0 comments · Fixed by #1517
Closed

Google Reader API: item ids base10 vs base16 #1498

lwindolf opened this issue Jul 17, 2022 · 0 comments · Fixed by #1517
Labels

Comments

@lwindolf
Copy link
Contributor

Maybe I'm overlooking something, but I believe the Google Reader API behaviour to be incorrect.

When I fetch item ids like this

  curl -H "Authorization: GoogleLogin auth=test/XXXXXXXXXXXXXXXXX" "http://admin@localhost:8080/reader/api/0/stream/items/ids?s=feed/2&output=json&n=10"

I get a JSON with base10 item ids. For example:

  {"itemRefs":[{"id":"2924"},{"id":"2931"},{"id":"2921"},{"id":"2932"},{"id":"2923"},{"id":"2928"},{"id":"2922"},{"id":"2927"},{"id":"2929"},{"id":"2926"}]}

When I use one of the ids to fetch the item

 curl -d "source=client&T=test/XXXXXXXXXXXXXXXXXX&output=json&i=2923" http://admin@localhost:8080/reader/api/0/stream/items/contents

then when fetching the most recent id I get

     {"error_message":"no items returned from the database"}

My understanding is the item ids are to be passed to /stream/items/contents as they are given by /stream/items/ids. But current the code does not do this. In googlereader/handler.go:348 base16 is applied.

func getItemIDs(r *http.Request) ([]int64, error) {
    [...]

    for i, item := range items {
	    var itemID int64
	    _, err := fmt.Sscanf(item, EntryIDLong, &itemID)
	    if err != nil {
		    itemID, err = strconv.ParseInt(item, 16, 64)       <<<<------- base16 

This is also visible in the log. The requested decimal item ids are treated as hex values causing much larger internal values which then do not exist. For comparison I also checked the FeedHQ Google Reader API implementation which does not indicate base16 and also original documentation mirros like https://raw.githubusercontent.com/mihaip/google-reader-api/master/wiki/ApiStreamItemsContents.wiki which also indicate decimal input values.

Please advise if my debugging is correct then I provide a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

1 participant