Skip to content

Commit

Permalink
Merge pull request #282 from sasjs/issue-281
Browse files Browse the repository at this point in the history
fix: SASJS_WEBOUT_HEADERS path for windows
  • Loading branch information
allanbowe authored Sep 19, 2022
2 parents b88c911 + 0327f7c commit 3bda991
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 35 deletions.
14 changes: 7 additions & 7 deletions api/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"author": "4GL Ltd",
"dependencies": {
"@sasjs/core": "^4.31.3",
"@sasjs/utils": "2.42.1",
"@sasjs/utils": "2.48.1",
"bcryptjs": "^2.4.3",
"connect-mongo": "^4.6.0",
"cookie-parser": "^1.4.6",
Expand Down
12 changes: 4 additions & 8 deletions api/src/controllers/internal/createJSProgram.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isWindows } from '@sasjs/utils'
import { escapeWinSlashes } from '@sasjs/utils'
import { PreProgramVars, Session } from '../../types'
import { generateFileUploadJSCode } from '../../utils'
import { ExecutionVars } from './'
Expand All @@ -21,13 +21,9 @@ export const createJSProgram = async (

const preProgramVarStatments = `
let _webout = '';
const weboutPath = '${
isWindows() ? weboutPath.replace(/\\/g, '\\\\') : weboutPath
}';
const _SASJS_TOKENFILE = '${
isWindows() ? tokenFile.replace(/\\/g, '\\\\') : tokenFile
}';
const _SASJS_WEBOUT_HEADERS = '${headersPath}';
const weboutPath = '${escapeWinSlashes(weboutPath)}';
const _SASJS_TOKENFILE = '${escapeWinSlashes(tokenFile)}';
const _SASJS_WEBOUT_HEADERS = '${escapeWinSlashes(headersPath)}';
const _SASJS_USERNAME = '${preProgramVariables?.username}';
const _SASJS_USERID = '${preProgramVariables?.userId}';
const _SASJS_DISPLAYNAME = '${preProgramVariables?.displayName}';
Expand Down
14 changes: 5 additions & 9 deletions api/src/controllers/internal/createPythonProgram.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isWindows } from '@sasjs/utils'
import { escapeWinSlashes } from '@sasjs/utils'
import { PreProgramVars, Session } from '../../types'
import { generateFileUploadPythonCode } from '../../utils'
import { ExecutionVars } from './'
Expand All @@ -19,14 +19,10 @@ export const createPythonProgram = async (
)

const preProgramVarStatments = `
_SASJS_SESSION_PATH = '${
isWindows() ? session.path.replace(/\\/g, '\\\\') : session.path
}';
_WEBOUT = '${isWindows() ? weboutPath.replace(/\\/g, '\\\\') : weboutPath}';
_SASJS_WEBOUT_HEADERS = '${headersPath}';
_SASJS_TOKENFILE = '${
isWindows() ? tokenFile.replace(/\\/g, '\\\\') : tokenFile
}';
_SASJS_SESSION_PATH = '${escapeWinSlashes(session.path)}';
_WEBOUT = '${escapeWinSlashes(weboutPath)}';
_SASJS_WEBOUT_HEADERS = '${escapeWinSlashes(headersPath)}';
_SASJS_TOKENFILE = '${escapeWinSlashes(tokenFile)}';
_SASJS_USERNAME = '${preProgramVariables?.username}';
_SASJS_USERID = '${preProgramVariables?.userId}';
_SASJS_DISPLAYNAME = '${preProgramVariables?.displayName}';
Expand Down
14 changes: 5 additions & 9 deletions api/src/controllers/internal/createRProgram.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isWindows } from '@sasjs/utils'
import { escapeWinSlashes } from '@sasjs/utils'
import { PreProgramVars, Session } from '../../types'
import { generateFileUploadRCode } from '../../utils'
import { ExecutionVars } from '.'
Expand All @@ -19,14 +19,10 @@ export const createRProgram = async (
)

const preProgramVarStatments = `
._SASJS_SESSION_PATH <- '${
isWindows() ? session.path.replace(/\\/g, '\\\\') : session.path
}';
._WEBOUT <- '${isWindows() ? weboutPath.replace(/\\/g, '\\\\') : weboutPath}';
._SASJS_WEBOUT_HEADERS <- '${headersPath}';
._SASJS_TOKENFILE <- '${
isWindows() ? tokenFile.replace(/\\/g, '\\\\') : tokenFile
}';
._SASJS_SESSION_PATH <- '${escapeWinSlashes(session.path)}';
._WEBOUT <- '${escapeWinSlashes(weboutPath)}';
._SASJS_WEBOUT_HEADERS <- '${escapeWinSlashes(headersPath)}';
._SASJS_TOKENFILE <- '${escapeWinSlashes(tokenFile)}';
._SASJS_USERNAME <- '${preProgramVariables?.username}';
._SASJS_USERID <- '${preProgramVariables?.userId}';
._SASJS_DISPLAYNAME <- '${preProgramVariables?.displayName}';
Expand Down
3 changes: 2 additions & 1 deletion api/src/controllers/internal/createSASProgram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export const createSASProgram = async (
vars: ExecutionVars,
session: Session,
weboutPath: string,
headersPath: string,
tokenFile: string,
otherArgs?: any
) => {
Expand All @@ -23,7 +24,7 @@ export const createSASProgram = async (
%let _sasjs_displayname=${preProgramVariables?.displayName};
%let _sasjs_apiserverurl=${preProgramVariables?.serverUrl};
%let _sasjs_apipath=/SASjsApi/stp/execute;
%let _sasjs_webout_headers=%sysfunc(pathname(work))/../stpsrv_header.txt;
%let _sasjs_webout_headers=${headersPath};
%let _metaperson=&_sasjs_displayname;
%let _metauser=&_sasjs_username;
Expand Down
1 change: 1 addition & 0 deletions api/src/controllers/internal/processProgram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export const processProgram = async (
vars,
session,
weboutPath,
headersPath,
tokenFile,
otherArgs
)
Expand Down

0 comments on commit 3bda991

Please sign in to comment.