parses nested multipart/form-data requests
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
}
|
||||
|
||||
&__thumbnail {
|
||||
min-height: base(5);
|
||||
height: base(5);
|
||||
width: base(7);
|
||||
align-self: stretch;
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ const File = (props) => {
|
||||
const [dragCounter, setDragCounter] = useState(0);
|
||||
|
||||
const {
|
||||
initialData = {}, adminThumbnail, imageSizes, staticURL,
|
||||
initialData = {}, adminThumbnail, staticURL,
|
||||
} = props;
|
||||
|
||||
const { filename } = initialData;
|
||||
|
||||
@@ -45,7 +45,7 @@ const useFieldType = (options) => {
|
||||
const sendField = useCallback(async (valueToSend) => {
|
||||
const fieldToDispatch = { path, value: valueToSend };
|
||||
|
||||
fieldToDispatch.valid = typeof validate === 'function' ? await validate(valueToSend || '') : true;
|
||||
fieldToDispatch.valid = typeof validate === 'function' ? await validate(valueToSend) : true;
|
||||
|
||||
if (typeof fieldToDispatch.valid === 'string') {
|
||||
fieldToDispatch.errorMessage = fieldToDispatch.valid;
|
||||
|
||||
@@ -84,7 +84,7 @@ const update = async (args) => {
|
||||
|
||||
const { staticDir, imageSizes } = args.config.upload;
|
||||
|
||||
if (args.req.files || args.req.files.file) {
|
||||
if (args.req.files || (args.req.files && args.req.files.file)) {
|
||||
const fsSafeName = await getSafeFilename(staticDir, options.req.files.file.name);
|
||||
|
||||
await options.req.files.file.mv(`${staticDir}/${fsSafeName}`);
|
||||
|
||||
@@ -26,7 +26,9 @@ const middleware = (config) => {
|
||||
localizationMiddleware(config.localization),
|
||||
authenticate(config),
|
||||
identifyAPI('REST'),
|
||||
fileUpload(),
|
||||
fileUpload({
|
||||
parseNested: true,
|
||||
}),
|
||||
(req, res, next) => {
|
||||
if (config.cors) {
|
||||
if (config.cors.indexOf(req.headers.origin) > -1) {
|
||||
|
||||
Reference in New Issue
Block a user