#4427 API call repo/git/urls/ returns {username} in the SSH-style URL
Closed: Invalid 4 years ago by ttomecek. Opened 5 years ago by ttomecek.

Code:

request_url = self.get_api_url(self.repo, "git", "urls")

return_value = self._call_api(url=request_url, method="GET", data={})
return return_value["urls"]

Returns:

{
    'total_urls': 2,
    'urls': {
        'git': 'https://src.fedoraproject.org/forks/ttomecek/rpms/packit.git',
        'ssh': 'ssh://{username}@pkgs.fedoraproject.org/forks/ttomecek/rpms/packit.git'
    }
}

I don't think the username should be in there.


Metadata Update from @pingou:
- Issue set to the milestone: 5.6
- Issue tagged with: bug, easyfix

4 years ago

Looking at the code, it seems that it will fill in the username if an API token is provided. Login is optional, so you get {username} if it's set in the configuration file (which is the case for src.fp.o) and you don't provide an API token and you'll get the actual username if you provide one.

Can you confirm this works as intended?

Thanks for the ping, this was buried in my todo list.

I can confirm that filling in the token will result in expanding the username variable:

ipdb> pagure_token
'TJIW...'
ipdb> proj.get_git_urls()
{
  'git': 'https://src.stg.fedoraproject.org/rpms/tmux-top.git',
  'ssh': 'ssh://ttomecek@pkgs.stg.fedoraproject.org/rpms/tmux-top.git'
}

I wonder how come I did not populate the token when I created this issue originally.

Thanks for investigating!

Metadata Update from @ttomecek:
- Issue close_status updated to: Invalid
- Issue status updated to: Closed (was: Open)

4 years ago

Thanks for confirming :)

Login to comment on this ticket.

Metadata