From: Zooko O'Whielacronx Date: Wed, 8 Jul 2009 15:26:33 +0000 (-0700) Subject: immutable: base32-encode the keys to generate cache filenames that will work on all... X-Git-Url: https://git.rkrishnan.org/pf/content/en/seg/module-simplejson.decoder.html?a=commitdiff_plain;h=22d390acbbdebe807b850ab08bdf545efb6fbd61;p=tahoe-lafs%2Ftahoe-lafs.git immutable: base32-encode the keys to generate cache filenames that will work on all platforms --- 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):