Explorar o código

Fixing bug: invalid array key when the key name didn't contain the @ character

clement hai 1 ano
pai
achega
e13fc6208d
Modificáronse 1 ficheiros con 2 adicións e 2 borrados
  1. 2 2
      src/models/ssh.php

+ 2 - 2
src/models/ssh.php

@@ -19,8 +19,8 @@ function get_ssh_keys($id) {
                 for ($i = 0; $i < $info[0]["sshpublickey"]["count"]; $i++) {
                     $key = $info[0]["sshpublickey"][$i];
                     $key_name = array();
-                    preg_match("/\S+@\S+/", $key, $key_name);
-                    $keys[] = [$key_name[0] => $key];
+                    preg_match("/\S+/g", $key, $key_name);
+                    $keys[] = [$key_name[2] => $key];
                 }
                 return $keys;
             }