File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -153,6 +153,11 @@ def convert_field_keys(items):
153153 "DataRow.row_data missing when creating DataRow." )
154154
155155 row_data = args [DataRow .row_data .name ]
156+
157+ if isinstance (row_data , str ) and row_data .startswith ("s3:/" ):
158+ raise InvalidQueryError (
159+ "row_data: s3 assets must start with 'https'." )
160+
156161 if not isinstance (row_data , str ):
157162 # If the row data is an object, upload as a string
158163 args [DataRow .row_data .name ] = json .dumps (row_data )
@@ -425,6 +430,10 @@ def validate_keys(item):
425430 raise InvalidQueryError (
426431 "`row_data` missing when creating DataRow." )
427432
433+ if isinstance (item .get ('row_data' ),
434+ str ) and item .get ('row_data' ).startswith ("s3:/" ):
435+ raise InvalidQueryError (
436+ "row_data: s3 assets must start with 'https'." )
428437 invalid_keys = set (item ) - {
429438 * {f .name for f in DataRow .fields ()}, 'attachments' , 'media_type'
430439 }
Original file line number Diff line number Diff line change @@ -127,6 +127,18 @@ def test_get_data_row(data_row, client):
127127 assert client .get_data_row (data_row .uid )
128128
129129
130+ def test_create_invalid_aws_data_row (dataset , client ):
131+ with pytest .raises (labelbox .exceptions .InvalidQueryError ) as exc :
132+ dataset .create_data_row (row_data = "s3://labelbox-public-data/invalid" )
133+ assert "s3" in exc .value .message
134+
135+ with pytest .raises (labelbox .exceptions .InvalidQueryError ) as exc :
136+ dataset .create_data_rows ([{
137+ "row_data" : "s3://labelbox-public-data/invalid"
138+ }])
139+ assert "s3" in exc .value .message
140+
141+
130142def test_lookup_data_rows (client , dataset ):
131143 uid = str (uuid .uuid4 ())
132144 # 1 external id : 1 uid
You can’t perform that action at this time.
0 commit comments