@cryptotaxi247 / CoPilot / commits / 4d2de36c

refactor: Update connector ID check for YAML file uploads (#286)

The code changes in this commit modify the `upload_yaml_file` function in the `routes.py` file. The connector ID check for YAML file uploads has been updated to allow for multiple connector IDs. Previously, only connector ID 6 was allowed, but now connector IDs 5 and 6 are allowed. Additionally, the error detail message has been updated to reflect this change.

taylor_socfortress committed Sep 8, 2024 at 17:12 UTC 4d2de36c471b8c4e3e9879656d343926d1d190cc
1 file changed +2 -2
backend/app/connectors/routes.py
+2 -2
@@ -213,10 +213,10 @@ async def upload_yaml_file(
213 Raises:
214 HTTPException: An exception with a 400 status code is raised if the file format is incorrect or connector ID is not 6.
215 """
216 - if connector_id != 6:
216 + if connector_id not in [5, 6]:
217 raise HTTPException(
218 status_code=400,
219 - detail="Only the Velociraptor connector is allowed for YAML file uploads.",
219 + detail="Only the Velociraptor or another specific connector is allowed for YAML file uploads.",
220 )
221 if not file.filename.endswith(".yaml"):
222 raise HTTPException(status_code=400, detail="Only .yaml files are allowed.")