@@ -124,14 +124,22 @@ def caltechdata_edit(
124124 # Check if file links were provided in the metadata
125125 descriptions = []
126126 ex_file_links = []
127+ ex_file_descriptions = []
127128 if "descriptions" in metadata :
128129 for d in metadata ["descriptions" ]:
129130 if d ["description" ].startswith ("Files available via S3" ):
130131 file_text = d ["description" ]
131132 file_list = file_text .split ('href="' )
133+ # Check if we have file_descriptions
134+ split_comma = file_list [0 ].split (", " )
135+ if len (split_comma ) == 3 :
136+ ex_file_descriptions .append (split_comma [1 ])
132137 # Loop over links in description, skip header text
133138 for file in file_list [1 :]:
134139 ex_file_links .append (file .split ('"\n ' )[0 ])
140+ split_comma = file .split (", " )
141+ if len (split_comma ) == 3 :
142+ ex_file_descriptions .append (split_comma [1 ])
135143 else :
136144 descriptions .append (d )
137145 # We remove file link descriptions, and re-add below
@@ -145,7 +153,7 @@ def caltechdata_edit(
145153 # Otherwise we add file links found in the mtadata file
146154 elif ex_file_links :
147155 metadata = add_file_links (
148- metadata , ex_file_links , file_descriptions , s3_link = s3_link
156+ metadata , ex_file_links , ex_file_descriptions , s3_link = s3_link
149157 )
150158
151159 if authors == False :
0 commit comments