2du 4 лет назад
Родитель
Сommit
2f1c671ac8
3 измененных файлов с 9 добавлено и 8 удалено
  1. 1 1
      app.py
  2. 7 6
      route/edit_upload.py
  3. 1 1
      version.json

+ 1 - 1
app.py

@@ -412,7 +412,7 @@ app.route('/edit/<everything:name>', methods = ['POST', 'GET'])(edit)
 app.route('/edit/<everything:name>/doc_from/<everything:name_load>', methods = ['POST', 'GET'])(edit)
 app.route('/edit/<everything:name>/doc_section/<int:section>', methods = ['POST', 'GET'])(edit)
 
-app.route('/upload', methods = ['POST', 'GET'])(main_func_upload)
+app.route('/upload', methods = ['POST', 'GET'])(edit_upload)
 
 # 개편 예정
 app.route('/xref_reset/<everything:name>')(edit_backlink_reset)

+ 7 - 6
route/main_func_upload.py → route/edit_upload.py

@@ -1,6 +1,6 @@
 from .tool.func import *
 
-def main_func_upload():
+def edit_upload():
     with get_db_connect() as conn:
         curs = conn.cursor()
 
@@ -9,7 +9,8 @@ def main_func_upload():
         
         curs.execute(db_change('select data from other where name = "upload"'))
         db_data = curs.fetchall()
-        file_max = int(number_check(db_data[0][0])) if db_data and db_data[0][0] != '' else '2'
+        file_max = number_check(db_data[0][0]) if db_data and db_data[0][0] != '' else '2'
+        file_max = int(file_max)
 
         if flask.request.method == 'POST':
             if captcha_post(flask.request.form.get('g-recaptcha-response', flask.request.form.get('g-recaptcha', ''))) == 1:
@@ -18,9 +19,6 @@ def main_func_upload():
                 captcha_post('', 0)
 
             file_data = flask.request.files.getlist("f_data[]", None)
-            if not file_data:
-                return re_error('/error/9')
-
             file_len = len(file_data)
 
             if (file_max * 1000 * 1000 * file_len) < flask.request.content_length:
@@ -35,6 +33,9 @@ def main_func_upload():
                 file_num = 1
 
             for data in file_data:
+                if data.filename == '':
+                    return re_error('/error/9')
+                
                 value = os.path.splitext(data.filename)[1]
 
                 curs.execute(db_change("select html from html_filter where kind = 'extension'"))
@@ -112,7 +113,7 @@ def main_func_upload():
                 if file_num:
                     file_num += 1
 
-            conn.commit()
+                conn.commit()
 
             return redirect('/w/file:' + name)
         else:

+ 1 - 1
version.json

@@ -1,6 +1,6 @@
 {
     "beta" : {
-        "r_ver" : "v3.4.5 (stable2) (beta3) (dev20)",
+        "r_ver" : "v3.4.5 (stable2) (beta3) (dev21)",
         "c_ver" : "3500109",
         "s_ver" : "3500110"
     }