fix: strip null synth_engine from project JSON
- Frontend serialize: use undefined instead of null for synth_engine - Backend validate: strip None synth_engine from tracks before schema validation - Prevents 'None is not of type object' schema error
This commit is contained in:
@@ -99,6 +99,14 @@ def validate_project_data(data_json: str) -> str:
|
||||
data = json.loads(data_json)
|
||||
if "project_id" not in data:
|
||||
data["project_id"] = "temp_legacy_" + str(int(time.time()))
|
||||
# Strip null synth_engine from tracks (breaks schema validation)
|
||||
for session_key in ["main_session"] + [k for k in data.get("section_store", {})]:
|
||||
session = data.get(session_key)
|
||||
if not session:
|
||||
continue
|
||||
for track in session.get("tracks", []):
|
||||
if "synth_engine" in track and track["synth_engine"] is None:
|
||||
del track["synth_engine"]
|
||||
if "main_session" not in data:
|
||||
data = upgrade_project_json_if_needed(data)
|
||||
data_json = json.dumps(data)
|
||||
|
||||
Reference in New Issue
Block a user