Skip to content

Commit

Permalink
fix: squash more bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
darkobas2 committed Dec 20, 2022
1 parent f818a34 commit 96835b7
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions swarmsync.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,16 +234,18 @@ async def aioupload(file: FileManager, url: str, session: aiohttp.ClientSession,
if len(ref) > 64:
# if we have a reference and its longer than 64 then we can asume its encrypted upload
resp_dict = { "file": file.name, "reference": ref[:64], "decrypt": ref[64:], "size": file.size }
todo.remove({ "file": file.name })
write_list(TODO, todo)
if len(ref) == 64:
resp_dict = { "file": file.name, "reference": ref, "size": file.size }
if len(ref) < 64:
#something is wrong
print('Lenght of response is not correct! ', res.status)
quit()
cleanup(RESPONSES)
else:
print('\n\n An error occured: ', res.status)
# better quit on error
quit()
cleanup(RESPONSES)
#everything passed, write response
response_dict(RESPONSES, resp_dict)
return res
Expand Down Expand Up @@ -298,7 +300,7 @@ def clean_responses(file):
if data:
clean = OrderedDict((frozenset(item.items()),item) for item in data).values()
clean=str(clean).replace("odict_values(", "")
clean=str(clean).replace(")", "")
clean=''.join(clean.rstrip(')'))
write_dict(file, str(clean))

def cleanup(file):
Expand Down Expand Up @@ -460,9 +462,8 @@ def check():
retry=[]
for i in all_errors:
for x in checklist:
for y in x:
if y['reference'] == i['reference']:
retry.append(y['file'])
if x['reference'] == i['reference']:
retry.append(x['file'])
if retry != []:
write_list(RETRY, retry)

Expand Down

0 comments on commit 96835b7

Please sign in to comment.