From d8e514911ab0c2975be17ab45c24b33cfffee120 Mon Sep 17 00:00:00 2001 From: Phuoc Dinh Le <47278241+cuom1999@users.noreply.github.com> Date: Wed, 31 Mar 2021 21:32:15 -0500 Subject: [PATCH] Fix VNese bugs when after trimming --- judge/views/submission.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/judge/views/submission.py b/judge/views/submission.py index 5793ef1..4e278ac 100644 --- a/judge/views/submission.py +++ b/judge/views/submission.py @@ -141,16 +141,16 @@ def read_head_archive(archive, file): with archive.open(file) as f: return f.read(settings.TESTCASE_VISIBLE_LENGTH + 3) - def get_visible_content(data): data = data or b'' data = data.replace(b'\r\n', b'\r').replace(b'\r', b'\n') + + data = data.decode('utf-8') + if (len(data) > settings.TESTCASE_VISIBLE_LENGTH): data = data[:settings.TESTCASE_VISIBLE_LENGTH] - data += b'.' * 3 - elif not data.endswith(b'\n'): - data += b'\n' - return data.decode('utf-8') + data += '.' * 3 + return data def get_input_answer(case, archive):