validation = function ({type}) {
    // if we finish the data/importer logic, we forward the request to the specified importer

    /**
     * @param {import('express').Request} req
     * @param {import('express').Response} res
     * @param {import('express').NextFunction} next
     */
    return async function uploadValidation(req, res, next) {
        const extensions = (config.get('uploads')[type] && config.get('uploads')[type].extensions) || [];
        const contentTypes = (config.get('uploads')[type] && config.get('uploads')[type].contentTypes) || [];

        req.file = req.file || {};
        req.file.name = req.file.originalname;
        req.file.type = req.file.mimetype;

        // Check if a file was provided
        if (!checkFileExists(req.file)) {
            return next(new errors.ValidationError({
                message: tpl(messages[type].missingFile)
            }));
        }

        req.file.ext = path.extname(req.file.name).toLowerCase();

        // Check if the file is valid
        if (!checkFileIsValid(req.file, contentTypes, extensions)) {
            return next(new errors.UnsupportedMediaTypeError({
                message: tpl(messages[type].invalidFile, {extensions: extensions})
            }));
        }

        // Sanitize SVG files
        if (req.file.ext === '.svg' || req.file.ext === '.svgz') {
            const sanitized = await sanitizeSvg(req.file.path, req.file.ext === '.svgz');

            if (!sanitized) {
                return next(new errors.UnsupportedMediaTypeError({
                    message: tpl(messages.svg.invalidFile)
                }));
            }
        }

        next();
    };
}
@param {Object} options
@param {String} options.type - type of the file
@returns {import('express').RequestHandler}