1
0
mirror of https://github.com/sasjs/server.git synced 2026-01-06 22:20:06 +00:00

Merge pull request #110 from sasjs/issue-108

fix: increased req body size
This commit is contained in:
Allan Bowe
2022-03-28 14:22:44 +03:00
committed by GitHub
4 changed files with 6 additions and 30 deletions

View File

@@ -649,7 +649,6 @@ paths:
required: required:
- status - status
type: object type: object
description: "It's optional to either provide `_filePath` in url as query parameter\nOr provide `filePath` in body as form field.\nBut it's required to provide else API will respond with Bad Request."
summary: 'Delete file from SASjs Drive' summary: 'Delete file from SASjs Drive'
tags: tags:
- Drive - Drive
@@ -660,19 +659,10 @@ paths:
- -
in: query in: query
name: _filePath name: _filePath
required: false required: true
schema: schema:
type: string type: string
example: /Public/somefolder/some.file example: /Public/somefolder/some.file
requestBody:
required: false
content:
multipart/form-data:
schema:
type: object
properties:
filePath:
type: string
post: post:
operationId: SaveFile operationId: SaveFile
responses: responses:

View File

@@ -10,7 +10,6 @@ import {
copySASjsCore, copySASjsCore,
getWebBuildFolderPath, getWebBuildFolderPath,
loadAppStreamConfig, loadAppStreamConfig,
sasJSCoreMacros,
setProcessVariables setProcessVariables
} from './utils' } from './utils'
@@ -34,7 +33,7 @@ if (MODE?.trim() !== 'server' || CORS?.trim() === 'enable') {
app.use(cookieParser()) app.use(cookieParser())
app.use(morgan('tiny')) app.use(morgan('tiny'))
app.use(express.json({ limit: '50mb' })) app.use(express.json({ limit: '100mb' }))
app.use(express.static(path.join(__dirname, '../public'))) app.use(express.static(path.join(__dirname, '../public')))
const onError: ErrorRequestHandler = (err, req, res, next) => { const onError: ErrorRequestHandler = (err, req, res, next) => {

View File

@@ -108,20 +108,14 @@ export class DriveController {
} }
/** /**
* It's optional to either provide `_filePath` in url as query parameter
* Or provide `filePath` in body as form field.
* But it's required to provide else API will respond with Bad Request.
* *
* @summary Delete file from SASjs Drive * @summary Delete file from SASjs Drive
* @query _filePath Location of SAS program * @query _filePath Location of SAS program
* @example _filePath "/Public/somefolder/some.file" * @example _filePath "/Public/somefolder/some.file"
*/ */
@Delete('/file') @Delete('/file')
public async deleteFile( public async deleteFile(@Query() _filePath: string) {
@Query() _filePath?: string, return deleteFile(_filePath)
@FormField() filePath?: string
) {
return deleteFile((_filePath ?? filePath)!)
} }
/** /**
@@ -305,9 +299,3 @@ const updateFile = async (
return { status: 'success' } return { status: 'success' }
} }
const validateFilePath = async (filePath: string) => {
if (!(await fileExists(filePath))) {
throw 'DriveController: File does not exists.'
}
}

View File

@@ -57,12 +57,11 @@ driveRouter.get('/file', async (req, res) => {
driveRouter.delete('/file', async (req, res) => { driveRouter.delete('/file', async (req, res) => {
const { error: errQ, value: query } = fileParamValidation(req.query) const { error: errQ, value: query } = fileParamValidation(req.query)
const { error: errB, value: body } = fileBodyValidation(req.body)
if (errQ && errB) return res.status(400).send(errQ.details[0].message) if (errQ) return res.status(400).send(errQ.details[0].message)
try { try {
const response = await controller.deleteFile(query._filePath, body.filePath) const response = await controller.deleteFile(query._filePath)
res.send(response) res.send(response)
} catch (err: any) { } catch (err: any) {
res.status(403).send(err.toString()) res.status(403).send(err.toString())