From 5ab35b02c4417132dddb5a800982f31d0d50ef66 Mon Sep 17 00:00:00 2001 From: Saad Jutt Date: Thu, 9 Jun 2022 01:16:25 +0500 Subject: [PATCH 1/5] fix(appstream): redirect to relative + nested resource should be accessed --- api/src/routes/appStream/index.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/api/src/routes/appStream/index.ts b/api/src/routes/appStream/index.ts index 4a607e5..3954039 100644 --- a/api/src/routes/appStream/index.ts +++ b/api/src/routes/appStream/index.ts @@ -2,11 +2,7 @@ import path from 'path' import express, { Request } from 'express' import { folderExists } from '@sasjs/utils' -import { - addEntryToAppStreamConfig, - getFilesFolder, - getFullUrl -} from '../../utils' +import { addEntryToAppStreamConfig, getFilesFolder } from '../../utils' import { appStreamHtml } from './appStreamHtml' const appStreams: { [key: string]: string } = {} @@ -73,14 +69,16 @@ export const publishAppStream = async ( router.get(`/*`, function (req: Request, res, next) { const reqPath = req.path.replace(/^\//, '') - // Redirecting to url with trailing slash for base appStream URL only + // Redirecting to url with trailing slash for appStream base URL only if (reqPath.split('/').length === 1 && !reqPath.endsWith('/')) - return res.redirect(301, `${getFullUrl(req)}/`) + // navigating to same url with slash at start + return res.redirect(301, `${reqPath}/`) const appStream = reqPath.split('/')[0] const appStreamFilesPath = appStreams[appStream] if (appStreamFilesPath) { - const resourcePath = reqPath.split('/')[1] || 'index.html' + // resourcePath is without appStream base path + const resourcePath = reqPath.split('/').slice(1).join('/') || 'index.html' req.url = resourcePath From e7babb9f55d5949f2c436d2e309caccd0d7c3934 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Wed, 8 Jun 2022 20:21:22 +0000 Subject: [PATCH 2/5] chore(release): 0.3.7 [skip ci] ## [0.3.7](https://github.com/sasjs/server/compare/v0.3.6...v0.3.7) (2022-06-08) ### Bug Fixes * **appstream:** redirect to relative + nested resource should be accessed ([5ab35b0](https://github.com/sasjs/server/commit/5ab35b02c4417132dddb5a800982f31d0d50ef66)) --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ba53a6..72b89c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [0.3.7](https://github.com/sasjs/server/compare/v0.3.6...v0.3.7) (2022-06-08) + + +### Bug Fixes + +* **appstream:** redirect to relative + nested resource should be accessed ([5ab35b0](https://github.com/sasjs/server/commit/5ab35b02c4417132dddb5a800982f31d0d50ef66)) + ## [0.3.6](https://github.com/sasjs/server/compare/v0.3.5...v0.3.6) (2022-06-02) From 8a617a73ae63233332f5788c90f173d6cd5e1283 Mon Sep 17 00:00:00 2001 From: Mihajlo Date: Mon, 13 Jun 2022 14:01:12 +0200 Subject: [PATCH 3/5] fix: execution controller better error handling --- api/src/controllers/internal/Execution.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/src/controllers/internal/Execution.ts b/api/src/controllers/internal/Execution.ts index b4d8b4c..9c46601 100644 --- a/api/src/controllers/internal/Execution.ts +++ b/api/src/controllers/internal/Execution.ts @@ -43,7 +43,7 @@ export class ExecutionController { session?: Session ) { if (!(await fileExists(programPath))) - throw 'ExecutionController: SAS file does not exist.' + throw `ExecutionController: SAS file (${programPath}) does not exist.` const program = await readFile(programPath) From 3fa2a7e2e32f90050f6b09e30ce3ef725eb0b15f Mon Sep 17 00:00:00 2001 From: Mihajlo Medjedovic Date: Mon, 13 Jun 2022 12:25:06 +0000 Subject: [PATCH 4/5] fix: execution controller error details --- api/src/controllers/internal/Execution.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/src/controllers/internal/Execution.ts b/api/src/controllers/internal/Execution.ts index 9c46601..141942a 100644 --- a/api/src/controllers/internal/Execution.ts +++ b/api/src/controllers/internal/Execution.ts @@ -43,7 +43,7 @@ export class ExecutionController { session?: Session ) { if (!(await fileExists(programPath))) - throw `ExecutionController: SAS file (${programPath}) does not exist.` + throw `The Stored Program at (${vars._program}) does not exist, or you do not have permission to view it.` const program = await readFile(programPath) From 7e6635f40fde16e32e9745e6b20b3a231da50a99 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Mon, 13 Jun 2022 12:32:32 +0000 Subject: [PATCH 5/5] chore(release): 0.3.8 [skip ci] ## [0.3.8](https://github.com/sasjs/server/compare/v0.3.7...v0.3.8) (2022-06-13) ### Bug Fixes * execution controller better error handling ([8a617a7](https://github.com/sasjs/server/commit/8a617a73ae63233332f5788c90f173d6cd5e1283)) * execution controller error details ([3fa2a7e](https://github.com/sasjs/server/commit/3fa2a7e2e32f90050f6b09e30ce3ef725eb0b15f)) --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 72b89c0..9ded935 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +## [0.3.8](https://github.com/sasjs/server/compare/v0.3.7...v0.3.8) (2022-06-13) + + +### Bug Fixes + +* execution controller better error handling ([8a617a7](https://github.com/sasjs/server/commit/8a617a73ae63233332f5788c90f173d6cd5e1283)) +* execution controller error details ([3fa2a7e](https://github.com/sasjs/server/commit/3fa2a7e2e32f90050f6b09e30ce3ef725eb0b15f)) + ## [0.3.7](https://github.com/sasjs/server/compare/v0.3.6...v0.3.7) (2022-06-08)