remove no longer needed base64 on file sharing
parent
49ecffb245
commit
40eed73ff7
|
@ -41,7 +41,7 @@ def importBlockFromData(content):
|
||||||
metadata = metas[0]
|
metadata = metas[0]
|
||||||
if validatemetadata.validate_metadata(metadata, metas[2]): # check if metadata is valid
|
if validatemetadata.validate_metadata(metadata, metas[2]): # check if metadata is valid
|
||||||
if crypto.cryptoutils.verify_POW(content): # check if POW is enough/correct
|
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:
|
try:
|
||||||
blockHash = onionrstorage.set_data(content)
|
blockHash = onionrstorage.set_data(content)
|
||||||
except onionrexceptions.DiskAllocationReached:
|
except onionrexceptions.DiskAllocationReached:
|
||||||
|
|
|
@ -50,7 +50,7 @@ def add_file(singleBlock=False, blockType='bin'):
|
||||||
logger.info('Adding file... this might take a long time.', terminal=True)
|
logger.info('Adding file... this might take a long time.', terminal=True)
|
||||||
try:
|
try:
|
||||||
with open(_get_dir(filename), 'rb') as singleFile:
|
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:
|
if len(blockhash) > 0:
|
||||||
logger.info('File %s saved in block %s' % (filename, blockhash), terminal=True)
|
logger.info('File %s saved in block %s' % (filename, blockhash), terminal=True)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
@ -82,7 +82,7 @@ def get_file():
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with open(fileName, 'wb') as myFile:
|
with open(fileName, 'wb') as myFile:
|
||||||
myFile.write(base64.b64decode(Block(bHash).bcontent))
|
myFile.write(Block(bHash).bcontent)
|
||||||
except onionrexceptions.NoDataAvailable:
|
except onionrexceptions.NoDataAvailable:
|
||||||
logger.error('That block is not available. Trying again later may work.', terminal=True)
|
logger.error('That block is not available. Trying again later may work.', terminal=True)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue