Daniel Sheffield 1 год назад
Родитель
Сommit
d805a59757
1 измененных файлов с 10 добавлено и 4 удалено
  1. 10 4
      app/rest/pyapi.py

+ 10 - 4
app/rest/pyapi.py

@@ -148,7 +148,6 @@ def save(content: bytes, root='app/rest/static') -> str:
 
 
 @route('/clip', method=['GET', 'POST'])
-@route('/clip/', method=['GET', 'POST'])
 def clip():
     if request.method == 'GET':
         _hash = request.params.hash
@@ -198,9 +197,13 @@ def clip():
         )
 
 
+@route('/clip/', method='GET')
+def _clip(): return redirect(f'/clip')
+
+
 @route('/clip/<filename:path>', method='GET')
 def get_clip(filename):
-    filename = normalize_base32(filename)
+    filename = filename and normalize_base32(filename)
     if not request.params.raw.lower() == 'true':
         # TODO: return a form with timeout to a GET instead ?
         return redirect(f'/clip?hash={filename}')
@@ -213,7 +216,6 @@ def get_clip(filename):
 
 
 @route('/goto', method=['GET', 'POST'])
-@route('/goto/', method=['GET', 'POST'])
 def goto():
     if request.method == 'GET':
         _hash = request.params.hash
@@ -245,7 +247,11 @@ def goto():
         return redirect(f'/goto?hash={_b32}')
 
 
+@route('/goto/', method='GET')
+def _goto(): return redirect(f'/goto')
+
+
 @route('/goto/<filename:path>', method='GET')
 def redirect_goto(filename):
-    filename = normalize_base32(filename)
+    filename = filename and normalize_base32(filename)
     return redirect(f'/goto?hash={filename}&go=true')