1
0
Fork 0

Compare commits

...

2 commits

Author SHA1 Message Date
dece d7d4d47814 upload-text: check for required env vars 2022-06-01 10:42:35 +02:00
dece 468ccfd340 rofibangs: strip user input before using it 2022-06-01 10:42:35 +02:00
2 changed files with 7 additions and 1 deletions

View file

@ -67,7 +67,7 @@ def open_bang(config, handle, query):
else: else:
print("Unknown handle.") print("Unknown handle.")
return return
url = bang["url"].format(urllib.parse.quote(query)) url = bang["url"].format(urllib.parse.quote(query.strip()))
webbrowser.open_new_tab(url) webbrowser.open_new_tab(url)

View file

@ -20,6 +20,12 @@ usage() {
CONFIG_PATH="$HOME/.config/upload-text.conf" CONFIG_PATH="$HOME/.config/upload-text.conf"
[ -f "$CONFIG_PATH" ] && . "$CONFIG_PATH" [ -f "$CONFIG_PATH" ] && . "$CONFIG_PATH"
# Check for our environment variables.
if [ ! -v REMOTE_DEST ] || [ ! -v REMOTE_WWW ] || [ ! -v REMOTE_URL ]; then
echo "You need to provide all the required environment variables."
exit
fi
# Generate a simple HTML page from the content. # Generate a simple HTML page from the content.
BASENAME="$(basename "$1")" BASENAME="$(basename "$1")"
HTML_FILE="$(mktemp)" HTML_FILE="$(mktemp)"