From 890449801e4cf7a015108c5a72a2fae57b18c6d2 Mon Sep 17 00:00:00 2001
From: Brian Warner <warner@lothar.com>
Date: Wed, 14 Mar 2012 16:36:40 -0700
Subject: [PATCH] IServer.get_name(): remove v0- prefix from displayed server
 names

Don't remove the prefix if it isn't there: that avoids the need to fix tests
which use a bogus key (usually all-zeros).
---
 src/allmydata/storage_client.py | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/allmydata/storage_client.py b/src/allmydata/storage_client.py
index 9d36a8bd..72e6319a 100644
--- a/src/allmydata/storage_client.py
+++ b/src/allmydata/storage_client.py
@@ -190,9 +190,16 @@ class NativeStorageServer:
         ps = base32.a2b(str(ann["permutation-seed-base32"]))
         self._permutation_seed = ps
 
-        name = key_s or tubid_s
-        self._long_description = name
-        self._short_description = name[:8] # TODO: decide who adds []
+        if key_s:
+            self._long_description = key_s
+            if key_s.startswith("v0-"):
+                # remove v0- prefix from abbreviated name
+                self._short_description = key_s[3:3+8]
+            else:
+                self._short_description = key_s[:8]
+        else:
+            self._long_description = tubid_s
+            self._short_description = tubid_s[:8]
 
         self.announcement_time = time.time()
         self.last_connect_time = None
@@ -213,6 +220,8 @@ class NativeStorageServer:
             return self.rref.version
         return None
     def get_name(self): # keep methodname short
+        # TODO: decide who adds [] in the short description. It should
+        # probably be the output side, not here.
         return self._short_description
     def get_longname(self):
         return self._long_description
-- 
2.45.2