Skip to content

Commit

Permalink
sonar fix
Browse files Browse the repository at this point in the history
Signed-off-by: David Liu <david-khala@hotmail.com>
  • Loading branch information
davidkhala committed Feb 6, 2024
1 parent 987cab8 commit 99b6479
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions light/test/indexTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ describe('index Test', () => {
assert.ok(!isPath(null));
assert.ok(isPath('/tmp/date.tmp'));
assert.ok(isPath('/tmp/'));
assert.ok(!isPath('date.tmp'));

});
it('json from', () => {
Expand Down
File renamed without changes.
14 changes: 12 additions & 2 deletions main/baseApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import cors from 'cors';
import fs from 'fs';
import {isPath} from '@davidkhala/light/path.js';
import Multer from 'multer';

/**
* @type {string[]} minVersion: set the minimum TLS version to allow. Cannot be specified along with the secureProtocol option.
* It is not recommended to use less than TLSv1.2.
Expand Down Expand Up @@ -108,8 +109,17 @@ export const expressError = (app, onError, logger = console) => {
onError(err, res);
});
};
export const formDataRouter = (cacheDir) => {
const multerCache = Multer({dest: cacheDir});
export const formDataRouter = (cacheDir, fileSize) => {
const options = {
dest: cacheDir,
limits: {}
};

if (Number.isInteger(fileSize) && fileSize > 0) {
options.limits.fileSize = fileSize; // Compliant value: 8000000
}

const multerCache = Multer(options);
return multerCache.any();
};
export const formDataFilePaths = (req, property) => {
Expand Down

0 comments on commit 99b6479

Please sign in to comment.