From 3a2ecf6896674b8a16b4c403026359c46da28f1f Mon Sep 17 00:00:00 2001 From: Tomofumi Tanaka Date: Mon, 7 Apr 2014 22:26:27 +0900 Subject: [PATCH] Fix bug #340 --- src/main/scala/ssh/SshUtil.scala | 5 ++++- src/main/twirl/account/ssh.scala.html | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/scala/ssh/SshUtil.scala b/src/main/scala/ssh/SshUtil.scala index db578ded2..50e1cc91f 100644 --- a/src/main/scala/ssh/SshUtil.scala +++ b/src/main/scala/ssh/SshUtil.scala @@ -28,6 +28,9 @@ object SshUtil { } } - def fingerPrint(key: String): String = KeyUtils.getFingerPrint(str2PublicKey(key).get) + def fingerPrint(key: String): Option[String] = str2PublicKey(key) match { + case Some(publicKey) => Some(KeyUtils.getFingerPrint(publicKey)) + case None => None + } } diff --git a/src/main/twirl/account/ssh.scala.html b/src/main/twirl/account/ssh.scala.html index e6ee34c55..8f37ace26 100644 --- a/src/main/twirl/account/ssh.scala.html +++ b/src/main/twirl/account/ssh.scala.html @@ -17,7 +17,7 @@ @if(i != 0){
} - @key.title (@_root_.ssh.SshUtil.fingerPrint(key.publicKey)) + @key.title (@_root_.ssh.SshUtil.fingerPrint(key.publicKey).getOrElse("Key is invalid.")) Delete } @@ -42,4 +42,4 @@ -} \ No newline at end of file +}