@sasjs/core 4.18.1 → 4.18.4

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/base/mp_abort.sas CHANGED
@@ -85,7 +85,7 @@
85
85
  %end;
86
86
 
87
87
  /* Stored Process Server web app context */
88
- %if %symexist(_metaport)
88
+ %if %symexist(_METAFOLDER)
89
89
  or "&SYSPROCESSNAME "="Compute Server "
90
90
  or &mode=INCLUDE
91
91
  %then %do;
@@ -161,12 +161,14 @@
161
161
  /* send response in SASjs JSON format */
162
162
  data _null_;
163
163
  file _webout mod lrecl=32000 encoding='utf-8';
164
- length msg $32767 ;
164
+ length msg syswarningtext syserrortext $32767 ;
165
165
  sasdatetime=datetime();
166
166
  msg=symget('msg');
167
167
  %if &logline>0 %then %do;
168
168
  msg=cats(msg,'\n\nLog Extract:\n',symget('logmsg'));
169
169
  %end;
170
+ /* escape the escapes */
171
+ msg=tranwrd(msg,'\','\\');
170
172
  /* escape the quotes */
171
173
  msg=tranwrd(msg,'"','\"');
172
174
  /* ditch the CRLFs as chrome complains */
@@ -203,8 +203,15 @@
203
203
  prxchange('s/'!!'0A'x!!'/\n/',-1,
204
204
  prxchange('s/'!!'0D'x!!'/\r/',-1,
205
205
  prxchange('s/'!!'09'x!!'/\t/',-1,
206
+ prxchange('s/'!!'00'x!!'/\\u0000/',-1, /* NUL */
207
+ prxchange('s/'!!'0E'x!!'/\\u000E/',-1, /* SS */
208
+ prxchange('s/'!!'0F'x!!'/\\u000F/',-1, /* SF */
209
+ prxchange('s/'!!'01'x!!'/\\u0001/',-1, /* SOH */
210
+ prxchange('s/'!!'02'x!!'/\\u0002/',-1, /* STX */
211
+ prxchange('s/'!!'02'x!!'/\\u0010/',-1, /* DLE */
212
+ prxchange('s/'!!'11'x!!'/\\u0011/',-1, /* DC1 */
206
213
  prxchange('s/\\/\\\\/',-1,&&name&i)
207
- )))))!!'"';
214
+ ))))))))))))!!'"';
208
215
  %end;
209
216
  %end;
210
217
  run;
@@ -13,8 +13,8 @@
13
13
  <h4> SAS Macros </h4>
14
14
  @li mp_abort.sas
15
15
 
16
- @param libref the libref (not name) of the metadata library
17
- @param mAbort= If not assigned, HARD will call %mp_abort(), SOFT will
16
+ @param [in] libref The libref (not name) of the metadata library
17
+ @param [in] mAbort= If not assigned, HARD will call %mp_abort(), SOFT will
18
18
  silently return
19
19
 
20
20
  @returns libname statement
@@ -28,11 +28,11 @@
28
28
  libref
29
29
  ,mAbort=HARD
30
30
  )/*/STORE SOURCE*/;
31
-
31
+ %local mp_abort msg;
32
+ %let mp_abort=0;
32
33
  %if %sysfunc(libref(&libref)) %then %do;
33
- %local mp_abort msg; %let mp_abort=0;
34
34
  data _null_;
35
- length liburi LibName $200;
35
+ length liburi LibName msg $200;
36
36
  call missing(of _all_);
37
37
  nobj=metadata_getnobj("omsobj:SASLibrary?@Libref='&libref'",1,liburi);
38
38
  if nobj=1 then do;
@@ -46,7 +46,24 @@
46
46
  * not always helpful though. One example, previously received:
47
47
  * NOTE: Libref XX refers to the same library metadata as libref XX.
48
48
  */
49
- call symputx('msg',sysmsg(),'l');
49
+ msg=sysmsg();
50
+ if msg=:'ERROR: Libref SAVE is not assigned.' then do;
51
+ msg=catx(" ",
52
+ "Could not assign %upcase(&libref).",
53
+ "Please check metadata permissions! Libname:",libname,
54
+ "Liburi:",liburi
55
+ );
56
+ end;
57
+ else if msg="ERROR: User does not have appropriate authorization "!!
58
+ "level for library SAVE."
59
+ then do;
60
+ msg=catx(" ",
61
+ "ERROR: User does not have appropriate authorization level",
62
+ "for library %upcase(&libref), libname:",libname,
63
+ "Liburi:",liburi
64
+ );
65
+ end;
66
+ call symputx('msg',msg,'l');
50
67
  if "&mabort"='HARD' then call symputx('mp_abort',1,'l');
51
68
  end;
52
69
  else do;
@@ -65,20 +82,16 @@
65
82
  end;
66
83
  run;
67
84
 
68
- %if &mp_abort=1 %then %do;
69
- %mp_abort(iftrue= (&mp_abort=1)
70
- ,mac=mm_assignlib.sas
71
- ,msg=&msg
72
- )
73
- %return;
74
- %end;
75
- %else %if %length(&msg)>2 %then %do;
76
- %put NOTE: &msg;
77
- %return;
78
- %end;
85
+ %put NOTE: &msg;
79
86
 
80
87
  %end;
81
88
  %else %do;
82
89
  %put NOTE: Library &libref is already assigned;
83
90
  %end;
91
+
92
+ %mp_abort(iftrue= (&mp_abort=1)
93
+ ,mac=mm_assignlib.sas
94
+ ,msg=%superq(msg)
95
+ )
96
+
84
97
  %mend mm_assignlib;
@@ -236,8 +236,15 @@ data _null_;
236
236
  put ' prxchange(''s/''!!''0A''x!!''/\n/'',-1, ';
237
237
  put ' prxchange(''s/''!!''0D''x!!''/\r/'',-1, ';
238
238
  put ' prxchange(''s/''!!''09''x!!''/\t/'',-1, ';
239
+ put ' prxchange(''s/''!!''00''x!!''/\\u0000/'',-1, /* NUL */ ';
240
+ put ' prxchange(''s/''!!''0E''x!!''/\\u000E/'',-1, /* SS */ ';
241
+ put ' prxchange(''s/''!!''0F''x!!''/\\u000F/'',-1, /* SF */ ';
242
+ put ' prxchange(''s/''!!''01''x!!''/\\u0001/'',-1, /* SOH */ ';
243
+ put ' prxchange(''s/''!!''02''x!!''/\\u0002/'',-1, /* STX */ ';
244
+ put ' prxchange(''s/''!!''02''x!!''/\\u0010/'',-1, /* DLE */ ';
245
+ put ' prxchange(''s/''!!''11''x!!''/\\u0011/'',-1, /* DC1 */ ';
239
246
  put ' prxchange(''s/\\/\\\\/'',-1,&&name&i) ';
240
- put ' )))))!!''"''; ';
247
+ put ' ))))))))))))!!''"''; ';
241
248
  put ' %end; ';
242
249
  put ' %end; ';
243
250
  put ' run; ';
package/package.json CHANGED
@@ -36,5 +36,5 @@
36
36
  "@sasjs/cli": "3.6.0",
37
37
  "@sasjs/core": "4.4.7"
38
38
  },
39
- "version": "4.18.1"
39
+ "version": "4.18.4"
40
40
  }
@@ -29,9 +29,10 @@
29
29
  ,mdebug=0
30
30
  );
31
31
 
32
- %local fname0 fname1 boundary fname statcd msg;
32
+ %local fname0 fname1 fname2 boundary fname statcd msg;
33
33
  %let fname0=%mf_getuniquefileref();
34
34
  %let fname1=%mf_getuniquefileref();
35
+ %let fname2=%mf_getuniquefileref();
35
36
  %let boundary=%mf_getuniquename();
36
37
 
37
38
  data _null_;
@@ -55,17 +56,25 @@ data _null_;
55
56
  end;
56
57
  run;
57
58
 
59
+ data _null_;
60
+ file &fname1;
61
+ put "Content-Type: multipart/form-data; boundary=&boundary";
62
+ run;
63
+
58
64
  %if &mdebug=1 %then %do;
59
65
  data _null_;
60
66
  infile &fname0;
61
67
  input;
62
68
  put _infile_;
69
+ data _null_;
70
+ infile &fname1;
71
+ input;
72
+ put _infile_;
63
73
  run;
64
74
  %end;
65
75
 
66
- proc http method='POST' in=&fname0 out=&fname1
76
+ proc http method='POST' in=&fname0 headerin=&fname1 out=&fname2
67
77
  url="&_sasjs_apiserverurl/SASjsApi/drive/file";
68
- headers "Content-Type"="multipart/form-data; boundary=&boundary";
69
78
  %if &mdebug=1 %then %do;
70
79
  debug level=1;
71
80
  %end;
@@ -73,7 +82,7 @@ run;
73
82
 
74
83
  %let statcd=0;
75
84
  data _null_;
76
- infile &fname1;
85
+ infile &fname2;
77
86
  input;
78
87
  putlog _infile_;
79
88
  if _infile_='{"status":"success"}' then call symputx('statcd',1,'l');
@@ -380,8 +380,15 @@ data _null_;
380
380
  put ' prxchange(''s/''!!''0A''x!!''/\n/'',-1, ';
381
381
  put ' prxchange(''s/''!!''0D''x!!''/\r/'',-1, ';
382
382
  put ' prxchange(''s/''!!''09''x!!''/\t/'',-1, ';
383
+ put ' prxchange(''s/''!!''00''x!!''/\\u0000/'',-1, /* NUL */ ';
384
+ put ' prxchange(''s/''!!''0E''x!!''/\\u000E/'',-1, /* SS */ ';
385
+ put ' prxchange(''s/''!!''0F''x!!''/\\u000F/'',-1, /* SF */ ';
386
+ put ' prxchange(''s/''!!''01''x!!''/\\u0001/'',-1, /* SOH */ ';
387
+ put ' prxchange(''s/''!!''02''x!!''/\\u0002/'',-1, /* STX */ ';
388
+ put ' prxchange(''s/''!!''02''x!!''/\\u0010/'',-1, /* DLE */ ';
389
+ put ' prxchange(''s/''!!''11''x!!''/\\u0011/'',-1, /* DC1 */ ';
383
390
  put ' prxchange(''s/\\/\\\\/'',-1,&&name&i) ';
384
- put ' )))))!!''"''; ';
391
+ put ' ))))))))))))!!''"''; ';
385
392
  put ' %end; ';
386
393
  put ' %end; ';
387
394
  put ' run; ';