File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
sdk/ai/azure-ai-projects/tests Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -105,10 +105,15 @@ def patched_open_crlf_to_lf(*args, **kwargs):
105105
106106 # Only create temp file if conversion was needed
107107 if converted_content != content :
108- # Create a temporary file with the converted content
109- temp_fd , temp_path = tempfile .mkstemp (suffix = ext )
110- os .write (temp_fd , converted_content )
111- os .close (temp_fd )
108+ # Create a sub temp folder and save file with same filename
109+ temp_dir = tempfile .mkdtemp ()
110+ original_filename = os .path .basename (file_path )
111+ temp_path = os .path .join (temp_dir , original_filename )
112+
113+ # Write the converted content to the temp file
114+ with _BUILTIN_OPEN (temp_path , "wb" ) as temp_file :
115+ temp_file .write (converted_content )
116+
112117 # Replace file path with temp path
113118 if args :
114119 # File path was passed as positional arg
You can’t perform that action at this time.
0 commit comments