home
·
contact
·
privacy
projects
/
url-catcher
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
5fbddbc
)
Use bottle's alternate direct property access to get unicode POSTs.
author
Christian Heller
<c.heller@plomlompom.de>
Thu, 26 Jan 2017 01:01:03 +0000
(
02:01
+0100)
committer
Christian Heller
<c.heller@plomlompom.de>
Thu, 26 Jan 2017 01:01:03 +0000
(
02:01
+0100)
url_catcher.py
patch
|
blob
|
history
diff --git
a/url_catcher.py
b/url_catcher.py
index 0121896e997924f14e55d5dab3af7531df1b2e15..5f5b03095890f90645689467f137dbb34b88f4e8 100755
(executable)
--- a/
url_catcher.py
+++ b/
url_catcher.py
@@
-116,7
+116,7
@@
def post_link():
str(start_date) + '\n' + str(attempts), 'w')
# Derive page / page file name.
str(start_date) + '\n' + str(attempts), 'w')
# Derive page / page file name.
- page = bottle.request.forms.
get('page')
+ page = bottle.request.forms.
page
if '\0' in page or '/' in page or '.' in page or len(page.encode()) > 255:
return bottle.HTTPResponse(messages['badPageName'], 400)
if '\0' in page or '/' in page or '.' in page or len(page.encode()) > 255:
return bottle.HTTPResponse(messages['badPageName'], 400)
@@
-124,12
+124,12
@@
def post_link():
captcha_file = open(captchas_dir + '/' + page, 'r')
captcha_correct = captcha_file.readline().rstrip()
captcha_file.close()
captcha_file = open(captchas_dir + '/' + page, 'r')
captcha_correct = captcha_file.readline().rstrip()
captcha_file.close()
- captcha_input = bottle.request.forms.
get('captcha')
+ captcha_input = bottle.request.forms.
captcha
if captcha_correct != captcha_input:
return bottle.HTTPResponse(messages['wrongCaptcha'], 400)
# Record URL.
if captcha_correct != captcha_input:
return bottle.HTTPResponse(messages['wrongCaptcha'], 400)
# Record URL.
- url = bottle.request.forms.
get('url')
+ url = bottle.request.forms.
url
if not validators.url(url):
return bottle.HTTPResponse(messages['invalidURL'], 400)
send_mail(page, url)
if not validators.url(url):
return bottle.HTTPResponse(messages['invalidURL'], 400)
send_mail(page, url)