From 22d390acbbdebe807b850ab08bdf545efb6fbd61 Mon Sep 17 00:00:00 2001
From: Zooko O'Whielacronx <zooko@zooko.com>
Date: Wed, 8 Jul 2009 08:26:33 -0700
Subject: [PATCH] immutable: base32-encode the keys to generate cache filenames
 that will work on all platforms

---
 src/allmydata/immutable/filenode.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/allmydata/immutable/filenode.py b/src/allmydata/immutable/filenode.py
index 1e83f344..fac141b7 100644
--- a/src/allmydata/immutable/filenode.py
+++ b/src/allmydata/immutable/filenode.py
@@ -105,7 +105,7 @@ class DownloadCache:
     def read(self, consumer, offset, size):
         assert offset+size <= self.get_filesize()
         if not self.cachefile:
-            self.cachefile = self.cachedirectorymanager.get_file(self._storage_index)
+            self.cachefile = self.cachedirectorymanager.get_file(base32.b2a(self._storage_index))
         f = PortionOfFile(self.cachefile.get_filename(), offset, size)
         d = basic.FileSender().beginFileTransfer(f, consumer)
         d.addCallback(lambda lastSent: consumer)
@@ -146,7 +146,7 @@ class DownloadCache:
 
     def get_filesize(self):
         if not self.cachefile:
-            self.cachefile = self.cachedirectorymanager.get_file(self._storage_index)
+            self.cachefile = self.cachedirectorymanager.get_file(base32.b2a(self._storage_index))
         try:
             filesize = os.stat(self.cachefile.get_filename())[stat.ST_SIZE]
         except OSError:
@@ -156,7 +156,7 @@ class DownloadCache:
 
     def open(self, size):
         if not self.cachefile:
-            self.cachefile = self.cachedirectorymanager.get_file(self._storage_index)
+            self.cachefile = self.cachedirectorymanager.get_file(base32.b2a(self._storage_index))
         self.f = open(self.cachefile.get_filename(), "wb")
 
     def write(self, data):
-- 
2.45.2