Add newline delimiter to metadata+content

This commit is contained in:
Arinerron 2018-05-12 20:55:34 -07:00
parent fe4261c4a2
commit f9b93fd491
No known key found for this signature in database
GPG key ID: 99383627861C62F0
3 changed files with 8 additions and 8 deletions

View file

@ -334,7 +334,7 @@ class OnionrUtils:
'''
Find, decrypt, and return array of PMs (array of dictionary, {from, text})
'''
#blocks = self._core.getBlockList().split('\n')
#blocks = self._core.getBlockList()
blocks = self._core.getBlocksByType('pm')
message = ''
sender = ''
@ -344,8 +344,8 @@ class OnionrUtils:
try:
with open('data/blocks/' + i + '.dat', 'r') as potentialMessage:
potentialMessage = potentialMessage.read()
blockMetadata = json.loads(potentialMessage[:potentialMessage.rfind('}') + 1])
blockContent = potentialMessage[potentialMessage.rfind('}') + 1:]
blockMetadata = json.loads(potentialMessage[:potentialMessage.find('\n')])
blockContent = potentialMessage[potentialMessage.find('\n') + 1:]
try:
message = self._core._crypto.pubKeyDecrypt(blockContent, encodedData=True, anonymous=True)