encryptType no longer set when encryption not used
This commit is contained in:
parent
0c196e8135
commit
dd87ad8999
@ -53,10 +53,11 @@ def insert_block(data, header='txt', sign=False, encryptType='', symKey='', asym
|
|||||||
|
|
||||||
meta['type'] = str(header)
|
meta['type'] = str(header)
|
||||||
|
|
||||||
if encryptType in ('asym', 'sym', ''):
|
if encryptType in ('asym', 'sym'):
|
||||||
metadata['encryptType'] = encryptType
|
metadata['encryptType'] = encryptType
|
||||||
else:
|
else:
|
||||||
raise onionrexceptions.InvalidMetadata('encryptType must be asym or sym, or blank')
|
if not encryptType in ('', None):
|
||||||
|
raise onionrexceptions.InvalidMetadata('encryptType must be asym or sym, or blank')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
data = data.encode()
|
data = data.encode()
|
||||||
|
@ -40,10 +40,5 @@ def get_block_metadata_from_data(block_data):
|
|||||||
else:
|
else:
|
||||||
data = block_data[block_data.find(b'\n'):].decode()
|
data = block_data[block_data.find(b'\n'):].decode()
|
||||||
|
|
||||||
if not metadata['encryptType'] in ('asym', 'sym'):
|
|
||||||
try:
|
|
||||||
meta = json.loads(metadata['meta'])
|
|
||||||
except KeyError:
|
|
||||||
pass
|
|
||||||
meta = metadata['meta']
|
meta = metadata['meta']
|
||||||
return (metadata, meta, data)
|
return (metadata, meta, data)
|
||||||
|
@ -23,6 +23,7 @@ import dbcreator, filepaths
|
|||||||
home = identifyhome.identify_home()
|
home = identifyhome.identify_home()
|
||||||
|
|
||||||
def create_dirs():
|
def create_dirs():
|
||||||
|
"""Creates onionr data-related directories in order of the hardcoded list below"""
|
||||||
gen_dirs = [home, filepaths.block_data_location, filepaths.contacts_location, filepaths.export_location]
|
gen_dirs = [home, filepaths.block_data_location, filepaths.contacts_location, filepaths.export_location]
|
||||||
for path in gen_dirs:
|
for path in gen_dirs:
|
||||||
if not os.path.exists(path):
|
if not os.path.exists(path):
|
||||||
|
Loading…
Reference in New Issue
Block a user