@sasjs/core 5.2.5 → 5.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -41,5 +41,5 @@
41
41
  "maintainers": [
42
42
  "https://sasapps.io"
43
43
  ],
44
- "version": "5.2.5"
44
+ "version": "5.2.6"
45
45
  }
@@ -272,10 +272,21 @@ data;run;%let jdswaitfor=&syslast;
272
272
  %if %length(&cvars)>0 %then %do ii=1 %to %sysfunc(countw(&cvars,%str( )));
273
273
  %let _vnm=%scan(&cvars,&ii,%str( ));
274
274
  if _param ne '' then _param=cats(_param,',');
275
+ /* The keys are V7 SAS names (from mf_getvarlist) so need no
276
+ * escaping. The values are free-form data - eg SASJS-formatted
277
+ * CSV payloads with embedded doubled quotes and CRLF row
278
+ * separators - so must be json escaped. The sas quote() function
279
+ * doubles any embedded double quotes (csv convention) which is
280
+ * invalid json and makes the jobExecution request fail with a
281
+ * 400 response. Raw control characters (CR/LF) are also invalid
282
+ * json - viya silently replaces them with spaces, corrupting
283
+ * multi-line CSV payloads. Escape backslashes first, then CR,
284
+ * LF, and finally double quotes. */
275
285
  _param=cats(_param,'"'
276
286
  ,"&_vnm"
277
- ,'":'
278
- ,quote(trim(&_vnm))
287
+ ,'":"'
288
+ ,tranwrd(tranwrd(tranwrd(tranwrd(trim(&_vnm),'\','\\'),'0D'x,'\r'),'0A'x,'\n'),'"','\"')
289
+ ,'"'
279
290
  );
280
291
  %end;
281
292
  %if %length(&nvars)>0 %then %do ii=1 %to %sysfunc(countw(&nvars,%str( )));