Răsfoiți Sursa

토론 이름 길이 제한

Surplus_Up (2DU) 7 ani în urmă
părinte
comite
0bb97ee14d
5 a modificat fișierele cu 12 adăugiri și 6 ștergeri
  1. 2 1
      language/en-US.json
  2. 2 1
      language/ko-KR.json
  3. 1 1
      route/close_topic_list.py
  4. 2 0
      route/tool/func.py
  5. 5 3
      route/topic.py

+ 2 - 1
language/en-US.json

@@ -245,5 +245,6 @@
             "decument_exist_error" : "The document already exists where you want to move it.",
             "password_diffrent_error" : "Reconfirm password and input password are different.",
             "edit_filter_error" : "Censored by edit filter.",
-            "file_name_error" : "Only alphabet, hangul, space, underscore, and minus signs are allowed for file names."
+            "file_name_error" : "Only alphabet, hangul, space, underscore, and minus signs are allowed for file names.",
+            "topic_long_error" : "The discussion name must not exceed 256 characters."
 }

+ 2 - 1
language/ko-KR.json

@@ -245,5 +245,6 @@
             "decument_exist_error" : "이동하려는 이름에 이미 문서가 존재합니다.",
             "password_diffrent_error" : "입력한 비밀번호와 비밀번호 확인이 서로 다릅니다.",
             "edit_filter_error" : "편집 필터에 의해 금지된 단어가 사용되었습니다.",
-            "file_name_error" : "파일 이름에는 알파벳, 한글, 공백, 밑줄 과 빼기 기호만 사용할 수 있습니다."
+            "file_name_error" : "파일 이름에는 알파벳, 한글, 공백, 밑줄 과 빼기 기호만 사용할 수 있습니다.",
+            "topic_long_error" : "토론 이름이 256자를 넘지 않아야 합니다."
 }

+ 1 - 1
route/close_topic_list.py

@@ -18,7 +18,7 @@ def close_topic_list_2(conn, name, tool):
             else:
                 break
 
-        return redirect('/topic/' + url_pas(name) + '/sub/' + url_pas(flask.request.form.get('topic', None) + t_num))
+        return redirect('/topic/' + url_pas(name) + '/sub/' + url_pas(flask.request.form.get('topic', 'test') + t_num))
     else:
         plus = ''
         menu = [['topic/' + url_pas(name), load_lang('return')]]

+ 2 - 0
route/tool/func.py

@@ -959,6 +959,8 @@ def re_error(data):
                 data = load_lang('file_exist_error')
             elif num == 10:
                 data = load_lang('password_error')
+            elif num == 11:
+                data = load_lang('topic_long_error')
             elif num == 13:
                 data = load_lang('recaptcha_error')
             elif num == 14:

+ 5 - 3
route/topic.py

@@ -5,6 +5,11 @@ def topic_2(conn, name, sub):
     
     ban = topic_check(name, sub)
     admin = admin_check(3)
+
+    curs.execute("select id from topic where title = ? and sub = ? limit 1", [name, sub])
+    topic_exist = curs.fetchall()
+    if not topic_exist and len(sub) > 256:
+        return re_error('/error/11')
     
     if flask.request.method == 'POST':
         if captcha_post(flask.request.form.get('g-recaptcha-response', '')) == 1:
@@ -53,9 +58,6 @@ def topic_2(conn, name, sub):
         curs.execute("select title from rd where title = ? and sub = ? and stop = 'S'", [name, sub])
         stop_data = curs.fetchall()
         
-        curs.execute("select id from topic where title = ? and sub = ? limit 1", [name, sub])
-        topic_exist = curs.fetchall()
-        
         display = ''
         all_data = ''
         data = ''