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