@@ -68,14 +68,14 @@ def save_file(
68
68
cls ,
69
69
name : str ,
70
70
content : Optional [Iterator [bytes ]] = None ,
71
- content_path : Optional [str ] = None ,
72
71
upload_storage : Optional [str ] = None ,
73
72
metadata : Optional [Dict [str , Any ]] = None ,
74
73
extra : Optional [Dict [str , Any ]] = None ,
75
74
headers : Optional [Dict [str , str ]] = None ,
75
+ content_path : Optional [str ] = None ,
76
76
) -> StoredFile :
77
77
if content is None and content_path is None :
78
- raise ValueError ("Either conent or content_path must be specified" )
78
+ raise ValueError ("Either content or content_path must be specified" )
79
79
if metadata is not None :
80
80
warnings .warn (
81
81
'metadata attribute is deprecated. Use extra={"meta_data": ...} instead' ,
@@ -104,12 +104,16 @@ def save_file(
104
104
iterator = get_metadata_file_obj (extra ["meta_data" ]),
105
105
object_name = f"{ name } .metadata.json" ,
106
106
)
107
- if content is None :
107
+ if content_path is not None :
108
108
return StoredFile (
109
109
container .upload_object (
110
- file_path = content_path , object_name = name , extra = extra , headers = headers
110
+ file_path = content_path ,
111
+ object_name = name ,
112
+ extra = extra ,
113
+ headers = headers ,
111
114
)
112
115
)
116
+ assert content is not None
113
117
return StoredFile (
114
118
container .upload_object_via_stream (
115
119
iterator = content , object_name = name , extra = extra , headers = headers
0 commit comments