From acbebddaccd1a7f495ce7af0701a417f5d3e9393 Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Fri, 8 Apr 2022 09:10:07 -0700 Subject: [PATCH] applets/ty.py: URL-encode form data --- applets/ty.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/applets/ty.py b/applets/ty.py index 0f15bd18..e6acf591 100755 --- a/applets/ty.py +++ b/applets/ty.py @@ -6,11 +6,17 @@ import subprocess url = 'https://based.lol/run.ty' if len(sys.argv) <= 1: - print('Usage: ty` [-stdin=]') + print('usage: ty` [-stdin=]') sys.exit(0) cmd = ' '.join(sys.argv[1:]).replace('\\n', '\n') [code, *input] = cmd.split('-stdin=') -print(subprocess.run(['curl', url, '-F', f'code={code}', '-F', f'input={"".join(input)}'], text=True, capture_output=True).stdout.rstrip()) +print( + subprocess.run([ + 'curl', url, + '--data-urlencode', f'code={code}', + '--data-urlencode', f'input={"".join(input)}' + ], text=True, capture_output=True).stdout.rstrip() +)