Skip to content
This repository was archived by the owner on May 6, 2024. It is now read-only.

Commit 38c0cc1

Browse files
user can input (unencrypted) JSON if they want
1 parent 7a70291 commit 38c0cc1

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

vantage/server/resource/task.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515

1616
from vantage.server import db
1717
from vantage.server import socketio
18+
from vantage.util import (
19+
prepare_bytes_for_transport,
20+
unpack_bytes_from_transport
21+
)
22+
from vantage.constants import STRING_ENCODING
1823

1924
module_name = __name__.split('.')[-1]
2025
log = logging.getLogger(module_name)
@@ -148,8 +153,10 @@ def post(self):
148153
input_ = [org.get("input") for org in organizations_json_list \
149154
if org.get("id")==organization.id].pop()
150155

151-
if not isinstance(input_, str):
152-
input_ = json.dumps(input_)
156+
if isinstance(input_, dict):
157+
input_ = prepare_bytes_for_transport(
158+
json.dumps(input_).encode(STRING_ENCODING)
159+
)
153160

154161
result = db.Result(
155162
task=task,

0 commit comments

Comments
 (0)