From 17bd7c166e4f2cd88a00d1e69f70dbea017e6795 Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 11 Nov 2022 09:40:40 +0100 Subject: [PATCH] Client - escape double quotes in notes when adding workout w/ gpx --- fittrackee_client/src/store/modules/workouts/actions.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fittrackee_client/src/store/modules/workouts/actions.ts b/fittrackee_client/src/store/modules/workouts/actions.ts index 7f643cc4..61216680 100644 --- a/fittrackee_client/src/store/modules/workouts/actions.ts +++ b/fittrackee_client/src/store/modules/workouts/actions.ts @@ -185,11 +185,12 @@ export const actions: ActionTree & if (!payload.file) { throw new Error('No file part') } + const notes = payload.notes.replace(/"/g, '\\"') const form = new FormData() form.append('file', payload.file) form.append( 'data', - `{"sport_id": ${payload.sport_id}, "notes": "${payload.notes}"}` + `{"sport_id": ${payload.sport_id}, "notes": "${notes}"}` ) authApi .post('workouts', form, {