remove no longer needed base64 on file sharing

This commit is contained in:
Kevin Froman 2019-10-29 02:12:30 -05:00
parent 49ecffb245
commit 40eed73ff7
2 changed files with 3 additions and 3 deletions

View File

@ -41,7 +41,7 @@ def importBlockFromData(content):
metadata = metas[0]
if validatemetadata.validate_metadata(metadata, metas[2]): # check if metadata is valid
if crypto.cryptoutils.verify_POW(content): # check if POW is enough/correct
logger.info('Block passed proof, saving.', terminal=True)
logger.info('Imported block passed proof, saving.', terminal=True)
try:
blockHash = onionrstorage.set_data(content)
except onionrexceptions.DiskAllocationReached:

View File

@ -50,7 +50,7 @@ def add_file(singleBlock=False, blockType='bin'):
logger.info('Adding file... this might take a long time.', terminal=True)
try:
with open(_get_dir(filename), 'rb') as singleFile:
blockhash = insert(base64.b64encode(singleFile.read()), header=blockType)
blockhash = insert(singleFile.read(), header=blockType)
if len(blockhash) > 0:
logger.info('File %s saved in block %s' % (filename, blockhash), terminal=True)
except Exception as e:
@ -82,7 +82,7 @@ def get_file():
try:
with open(fileName, 'wb') as myFile:
myFile.write(base64.b64decode(Block(bHash).bcontent))
myFile.write(Block(bHash).bcontent)
except onionrexceptions.NoDataAvailable:
logger.error('That block is not available. Trying again later may work.', terminal=True)