From 00db9c9f875f1f26904e92a6471300ee88e61d89 Mon Sep 17 00:00:00 2001 From: canewsin Date: Fri, 8 Apr 2022 23:12:10 +0530 Subject: [PATCH] Rust Version Compatibility for update Protocol msg and diff patch --- src/File/FileRequest.py | 4 ++++ src/util/Diff.py | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/File/FileRequest.py b/src/File/FileRequest.py index 85bbcdce8..e57a9f6b9 100644 --- a/src/File/FileRequest.py +++ b/src/File/FileRequest.py @@ -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)) diff --git a/src/util/Diff.py b/src/util/Diff.py index 8281188b8..53b82c5a0 100644 --- a/src/util/Diff.py +++ b/src/util/Diff.py @@ -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