diff --git a/api/public/swagger.yaml b/api/public/swagger.yaml index 0e3f52f5..8367ae1e 100644 --- a/api/public/swagger.yaml +++ b/api/public/swagger.yaml @@ -649,7 +649,6 @@ paths: required: - status 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' tags: - Drive @@ -660,19 +659,10 @@ paths: - in: query name: _filePath - required: false + required: true schema: type: string example: /Public/somefolder/some.file - requestBody: - required: false - content: - multipart/form-data: - schema: - type: object - properties: - filePath: - type: string post: operationId: SaveFile responses: diff --git a/api/src/app.ts b/api/src/app.ts index 0416d3e4..0634dcac 100644 --- a/api/src/app.ts +++ b/api/src/app.ts @@ -10,7 +10,6 @@ import { copySASjsCore, getWebBuildFolderPath, loadAppStreamConfig, - sasJSCoreMacros, setProcessVariables } from './utils' @@ -34,7 +33,7 @@ if (MODE?.trim() !== 'server' || CORS?.trim() === 'enable') { app.use(cookieParser()) app.use(morgan('tiny')) -app.use(express.json({ limit: '50mb' })) +app.use(express.json({ limit: '100mb' })) app.use(express.static(path.join(__dirname, '../public'))) const onError: ErrorRequestHandler = (err, req, res, next) => { diff --git a/api/src/controllers/drive.ts b/api/src/controllers/drive.ts index 1b116847..bccd41e5 100644 --- a/api/src/controllers/drive.ts +++ b/api/src/controllers/drive.ts @@ -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 * @query _filePath Location of SAS program * @example _filePath "/Public/somefolder/some.file" */ @Delete('/file') - public async deleteFile( - @Query() _filePath?: string, - @FormField() filePath?: string - ) { - return deleteFile((_filePath ?? filePath)!) + public async deleteFile(@Query() _filePath: string) { + return deleteFile(_filePath) } /** @@ -305,9 +299,3 @@ const updateFile = async ( return { status: 'success' } } - -const validateFilePath = async (filePath: string) => { - if (!(await fileExists(filePath))) { - throw 'DriveController: File does not exists.' - } -} diff --git a/api/src/routes/api/drive.ts b/api/src/routes/api/drive.ts index bd6af296..db0ce5de 100644 --- a/api/src/routes/api/drive.ts +++ b/api/src/routes/api/drive.ts @@ -57,12 +57,11 @@ driveRouter.get('/file', async (req, res) => { driveRouter.delete('/file', async (req, res) => { 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 { - const response = await controller.deleteFile(query._filePath, body.filePath) + const response = await controller.deleteFile(query._filePath) res.send(response) } catch (err: any) { res.status(403).send(err.toString())