File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 93
93
# under this when enqueuing a job to store BigQuery metadata, we truncate the
94
94
# Description field to 40K bytes, which captures up to the 95th percentile of
95
95
# existing descriptions.
96
- MAX_DESCRIPTION_LENGTH_TO_BIGQUERY = 40000
96
+ MAX_DESCRIPTION_LENGTH_TO_BIGQUERY_IN_BYTES = 40000
97
97
98
98
# Wheel platform checking
99
99
@@ -1611,7 +1611,10 @@ def file_upload(request):
1611
1611
"version" : str (meta .version ),
1612
1612
"summary" : meta .summary ,
1613
1613
"description" : (
1614
- meta .description [:MAX_DESCRIPTION_LENGTH_TO_BIGQUERY ]
1614
+ # Truncate the description by bytes and not characters if it is too long
1615
+ meta .description .encode ()[
1616
+ :MAX_DESCRIPTION_LENGTH_TO_BIGQUERY_IN_BYTES
1617
+ ].decode ("utf-8" , "ignore" )
1615
1618
if meta .description is not None
1616
1619
else None
1617
1620
),
You can’t perform that action at this time.
0 commit comments