@@ -10191,7 +10191,8 @@ if (@github_accounts) {
1019110191
1019210192 foreach my $user (@github_accounts ) {
1019310193 my $u = $github_accounts {$user };
10194- my $pub_key_file = $u -> {key_file } . " .pub" ;
10194+ # only append ".pub" if it's not already there
10195+ my $pub_key_file = $u -> {key_file } =~ / \. pub$ / ? $u -> {key_file } : $u -> {key_file }." .pub" ;
1019510196 if (-e $pub_key_file ) {
1019610197 if (open my $f , ' -|' , qw< ssh-keygen -l -f> , $pub_key_file ) {
1019710198 chomp (my $fingerprint = <$f >);
@@ -10596,7 +10597,7 @@ if (@unregistered_users) {
1059610597 if (@clip_cmd && @unregistered_users == 1 && !$offline ) {
1059710598 my $user = shift @unregistered_users ;
1059810599 # Copy the first key created to the clipboard
10599- my $pub_key_file = $github_accounts {$user }-> {key_file }." .pub" ;
10600+ my $pub_key_file = $github_accounts {$user }-> {key_file } =~ / \. pub $ / ? $github_accounts { $user } -> { key_file } : $github_accounts { $user } -> { key_file } ." .pub" ;
1060010601 # Read the public key from the file
1060110602 open my $pub , ' <' , $pub_key_file ;
1060210603 my $pubkey = <$pub >;
@@ -10616,7 +10617,8 @@ if (@unregistered_users) {
1061610617 . " <https://github.com/settings/keys>.\n " ;
1061710618 # Help the user to copy the other keys
1061810619 foreach my $user (@unregistered_users ) {
10619- my $pub_key = compress_path($github_accounts {$user }{key_file })." .pub" ;
10620+ my $key_path = compress_path($github_accounts {$user }{key_file });
10621+ my $pub_key = $key_path =~ / \. pub$ / ? $key_path : $key_path ." .pub" ;
1062010622 if (@clip_cmd ) {
1062110623 print " $user : @clip_cmd < $pub_key \n " ;
1062210624 } else {
0 commit comments