Skip to content

Commit

Permalink
Rust Version Compatibility for update Protocol msg
Browse files Browse the repository at this point in the history
 and diff patch
  • Loading branch information
canewsin committed Apr 8, 2022
1 parent 02ceb70 commit 00db9c9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/File/FileRequest.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@ def actionUpdate(self, params):

if should_validate_content:
try:
if type(body) is str:
body = body.encode()
# elif type(body) is list:
# content = json.loads(bytes(list).decode())
content = json.loads(body.decode())
except Exception as err:
site.log.debug("Update for %s is invalid JSON: %s" % (inner_path, err))
Expand Down
2 changes: 2 additions & 0 deletions src/util/Diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ def patch(old_f, actions):
continue
elif action == "+": # Add lines
for add_line in param:
if type(add_line) is str:
add_line = add_line.encode()
new_f.write(add_line)
else:
raise "Unknown action: %s" % action
Expand Down

0 comments on commit 00db9c9

Please sign in to comment.