소스 검색

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

clement 1 년 전
부모
커밋
e13fc6208d
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  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;
             }