Commit b25688d7 authored by Mindiell's avatar Mindiell
Browse files

Manage false paste identifiers

parent 7c56f871
......@@ -29,9 +29,12 @@ def send():
@app.route('/p')
def paste():
# Get first and only key arg
# Get first and only key arg to use as paste identifier
for key in request.args.keys():
return render_template(Vlozit().get_template(key))
template = Vlozit().get_template(key)
if template is not None:
return render_template()
return redirect('/')
# ================================================
......
......@@ -11,10 +11,12 @@ import config
class Vlozit():
def get_template(self, filename):
return (os.path.sep).join(("pastes",filename[0:2],filename[2:4],filename[4:6],filename))
path = (os.path.sep).join(("pastes",filename[0:2],filename[2:4],filename[4:6],filename))
if os.path.exists(path):
return path
def get_path(self, filename):
return (os.path.sep).join(("templates/pastes",filename[0:2],filename[2:4],filename[4:6],filename))
return (os.path.sep).join(("templates/pastes",filename[0:2],filename[2:4],filename[4:6],filename))
def create_paste(self, data):
# Idées possibles :
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment