@@ -55,6 +55,30 @@ def bad_4():
5555 return jsonify ({"error" : "File not found" }), 404
5656
5757
58+ @app .route ("/bad_5" )
59+ def bad_5 ():
60+ r = request .args .get ("r" , "" )
61+ length = len (r )
62+ if not length < 1_000 :
63+ # Normalize the r using NFKD Unicode normalization
64+ r = unicodedata .normalize ("NFKD" , r )
65+ return r , 200 , {"Content-Type" : "application/octet-stream" }
66+ else :
67+ return jsonify ({"error" : "File not found" }), 404
68+
69+
70+ @app .route ("/bad_6" )
71+ def bad_6 ():
72+ r = request .args .get ("r" , "" )
73+ length = len (r )
74+ if not 1_000 > length :
75+ # Normalize the r using NFKD Unicode normalization
76+ r = unicodedata .normalize ("NFKD" , r )
77+ return r , 200 , {"Content-Type" : "application/octet-stream" }
78+ else :
79+ return jsonify ({"error" : "File not found" }), 404
80+
81+
5882@app .route ("/good_1" )
5983def good_1 ():
6084 r = request .args .get ("r" , "" )
@@ -78,3 +102,28 @@ def good_2():
78102 return r , 200 , {"Content-Type" : "application/octet-stream" }
79103 else :
80104 return jsonify ({"error" : "File not found" }), 404
105+
106+ @app .route ("/good_3" )
107+ def good_3 ():
108+ r = request .args .get ("r" , "" )
109+ MAX_LENGTH = 1_000
110+ length = len (r )
111+ if not length >= MAX_LENGTH :
112+ # Normalize the r using NFKD Unicode normalization
113+ r = unicodedata .normalize ("NFKD" , r )
114+ return r , 200 , {"Content-Type" : "application/octet-stream" }
115+ else :
116+ return jsonify ({"error" : "File not found" }), 404
117+
118+
119+ @app .route ("/good_4" )
120+ def good_4 ():
121+ r = request .args .get ("r" , "" )
122+ MAX_LENGTH = 1_000
123+ length = len (r )
124+ if not MAX_LENGTH <= length :
125+ # Normalize the r using NFKD Unicode normalization
126+ r = unicodedata .normalize ("NFKD" , r )
127+ return r , 200 , {"Content-Type" : "application/octet-stream" }
128+ else :
129+ return jsonify ({"error" : "File not found" }), 404
0 commit comments