fix badge branch selection

Fix the badge handler to retrieve the branch from the query and not from the URL parameters.