@@ -64,7 +64,10 @@ def upload_file() -> flask.Response:
6464 flask .abort (400 , "Filename is required" )
6565 filename = werkzeug .utils .secure_filename (os .path .basename (file .filename ))
6666 print (f"{ filename = } " , flush = True )
67- file .save (os .path .join (UPLOAD_FOLDER , filename ))
67+ file_path = os .path .join (UPLOAD_FOLDER , filename )
68+ file .save (file_path )
69+ if filename .lower ().endswith (".csv.json" ):
70+ shutil .copyfile (file_path , os .path .join (UPLOAD_FOLDER , filename [:- 9 ] + ".json" ))
6871 return flask .make_response ({"message" : "File uploaded" }, 201 )
6972
7073
@@ -432,10 +435,11 @@ def export_project() -> flask.Response:
432435
433436 for data_id , native_file in rows :
434437 base_dir = os .path .join (project_folder , data_id )
435-
436- native_path = os .path .join (base_dir , str (native_file ))
437- if os .path .isfile (native_path ):
438- zip_file .write (native_path , os .path .join (data_id , str (native_file )))
438+ if os .path .isdir (base_dir ):
439+ for f_name in os .listdir (base_dir ):
440+ file_path = os .path .join (base_dir , f_name )
441+ if os .path .isfile (file_path ):
442+ zip_file .write (file_path , os .path .join (data_id , f_name ))
439443
440444 zip_file .writestr ("snapshot.json" , flask .json .dumps (params .snapshot ))
441445
0 commit comments