@@ -396,16 +396,18 @@ def contribute():
396396 validate_text_field (PR_TITLE , 'title' , max_length = 512 )
397397 validate_text_field (PR_BODY , 'desc' , max_length = 8192 )
398398
399+ # Build base command depending on platform
399400 if (platform .uname ()[0 ]== 'Windows' ):
400- # Use cmd.exe /c to invoke contribute.bat on Windows
401- proc = subprocess .run (["cmd.exe" , "/c" , "contribute.bat" , STUDY_NAME , STUDY_NAME_PATH , AUTHOR_NAME , BRANCH_NAME , PR_TITLE , PR_BODY ], cwd = concore_path , check = True , capture_output = True , text = True )
402- output_string = proc .stdout
401+ cmd = ["cmd.exe" , "/c" , "contribute.bat" , STUDY_NAME , STUDY_NAME_PATH , AUTHOR_NAME ]
403402 else :
404- if len (BRANCH_NAME )== 0 :
405- proc = check_output ([r"./contribute" ,STUDY_NAME ,STUDY_NAME_PATH ,AUTHOR_NAME ],cwd = concore_path )
406- else :
407- proc = check_output ([r"./contribute" ,STUDY_NAME ,STUDY_NAME_PATH ,AUTHOR_NAME ,BRANCH_NAME ,PR_TITLE ,PR_BODY ],cwd = concore_path )
408- output_string = proc .decode ()
403+ cmd = [r"./contribute" , STUDY_NAME , STUDY_NAME_PATH , AUTHOR_NAME ]
404+
405+ # Append optional branch/PR args only when BRANCH_NAME is provided
406+ if len (BRANCH_NAME ) > 0 :
407+ cmd .extend ([BRANCH_NAME , PR_TITLE , PR_BODY ])
408+
409+ proc = subprocess .run (cmd , cwd = concore_path , check = True , capture_output = True , text = True )
410+ output_string = proc .stdout
409411 status = 200
410412 if output_string .find ("/pulls/" )!= - 1 :
411413 status = 200
0 commit comments