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)
|
||||
|
||||
@@ -6137,7 +6137,7 @@ const serializeTracksList = (tracksList, secondsPerBar) => {
|
||||
soundfont_id: t.soundfont_id || (t.synth_engine ? t.synth_engine.soundfont_id : null),
|
||||
soundfont_bank: t.soundfont_bank !== undefined ? t.soundfont_bank : (t.synth_engine ? t.synth_engine.soundfont_bank : null),
|
||||
soundfont_program: t.soundfont_program !== undefined ? t.soundfont_program : (t.synth_engine ? t.synth_engine.soundfont_program : null),
|
||||
synth_engine: t.synth_engine || null,
|
||||
synth_engine: t.synth_engine || undefined,
|
||||
items: items
|
||||
};
|
||||
});
|
||||
@@ -6209,7 +6209,7 @@ const deserializeTracksList = (schemaTracks, secondsPerBar, sectionStore) => {
|
||||
soundfont_id: t.soundfont_id || null,
|
||||
soundfont_bank: t.soundfont_bank !== null ? t.soundfont_bank : undefined,
|
||||
soundfont_program: t.soundfont_program !== null ? t.soundfont_program : undefined,
|
||||
synth_engine: t.synth_engine || null
|
||||
synth_engine: t.synth_engine || undefined
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user