mirror of
https://github.com/sasjs/server.git
synced 2025-12-11 19:44:35 +00:00
fix: refactor code in preUploadMiddleware function
This commit is contained in:
@@ -33,19 +33,18 @@ export class FileUploadController {
|
|||||||
runTime
|
runTime
|
||||||
|
|
||||||
if (await fileExists(codePath)) {
|
if (await fileExists(codePath)) {
|
||||||
|
let sessionController
|
||||||
if (runTime === SASJSRunTimes.JS) {
|
if (runTime === SASJSRunTimes.JS) {
|
||||||
const sessionController = getJSSessionController()
|
sessionController = getJSSessionController()
|
||||||
const session = await sessionController.getSession()
|
|
||||||
req.sasjsSession = session
|
|
||||||
} else {
|
} else {
|
||||||
const sessionController = getSASSessionController()
|
sessionController = getSASSessionController()
|
||||||
|
}
|
||||||
const session = await sessionController.getSession()
|
const session = await sessionController.getSession()
|
||||||
// marking consumed true, so that it's not available
|
// marking consumed true, so that it's not available
|
||||||
// as readySession for any other request
|
// as readySession for any other request
|
||||||
session.consumed = true
|
session.consumed = true
|
||||||
|
|
||||||
req.sasjsSession = session
|
req.sasjsSession = session
|
||||||
}
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user