mirror of
https://github.com/sasjs/server.git
synced 2026-01-17 10:50:05 +00:00
Merge branch 'main' into issue-184
This commit is contained in:
15
CHANGELOG.md
15
CHANGELOG.md
@@ -1,3 +1,18 @@
|
|||||||
|
## [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)
|
||||||
|
|
||||||
|
|
||||||
|
### 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)
|
## [0.3.6](https://github.com/sasjs/server/compare/v0.3.5...v0.3.6) (2022-06-02)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ export class ExecutionController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw `ExecutionController: ${programPath} file does not exist.`
|
throw `The Stored Program at "${programPath}" does not exist, or you do not have permission to view it.`
|
||||||
}
|
}
|
||||||
|
|
||||||
async executeProgram(
|
async executeProgram(
|
||||||
|
|||||||
@@ -2,11 +2,7 @@ import path from 'path'
|
|||||||
import express, { Request } from 'express'
|
import express, { Request } from 'express'
|
||||||
import { folderExists } from '@sasjs/utils'
|
import { folderExists } from '@sasjs/utils'
|
||||||
|
|
||||||
import {
|
import { addEntryToAppStreamConfig, getFilesFolder } from '../../utils'
|
||||||
addEntryToAppStreamConfig,
|
|
||||||
getFilesFolder,
|
|
||||||
getFullUrl
|
|
||||||
} from '../../utils'
|
|
||||||
import { appStreamHtml } from './appStreamHtml'
|
import { appStreamHtml } from './appStreamHtml'
|
||||||
|
|
||||||
const appStreams: { [key: string]: string } = {}
|
const appStreams: { [key: string]: string } = {}
|
||||||
@@ -73,14 +69,16 @@ export const publishAppStream = async (
|
|||||||
router.get(`/*`, function (req: Request, res, next) {
|
router.get(`/*`, function (req: Request, res, next) {
|
||||||
const reqPath = req.path.replace(/^\//, '')
|
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('/'))
|
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 appStream = reqPath.split('/')[0]
|
||||||
const appStreamFilesPath = appStreams[appStream]
|
const appStreamFilesPath = appStreams[appStream]
|
||||||
if (appStreamFilesPath) {
|
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
|
req.url = resourcePath
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user