diff --git a/.stylelintrc.js b/.stylelintrc.js new file mode 100644 index 00000000..c5f3b0ab --- /dev/null +++ b/.stylelintrc.js @@ -0,0 +1,9 @@ +module.exports = { + extends: [ + '../../.stylelintrc.js' + ], + ignoreFiles: [ + 'node_modules/**/*', + 'vendor/**/*' + ], +}; diff --git a/CHANGELOG.md b/CHANGELOG.md index 056f067f..e27f2981 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [UNRELEASED] + +### Fixed + +- Fix file upload + + ## [2.15.0] - 2025-09-30 ### Added diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 00000000..cbdc9576 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,11 @@ +import glpiEslintConfig from '../../eslint.config.mjs'; + +export default [ + ...glpiEslintConfig, + { + ignores: [ + 'node_modules/*', + 'vendor/*', + ], + } +]; diff --git a/inc/backend.class.php b/inc/backend.class.php index 98b94ea7..be68d99c 100644 --- a/inc/backend.class.php +++ b/inc/backend.class.php @@ -27,7 +27,7 @@ * @link https://github.com/pluginsGLPI/datainjection * ------------------------------------------------------------------------- */ -use Glpi\Exception\Http\HttpException; + use function Safe\preg_match; @@ -78,12 +78,17 @@ public static function getHeader($injectionData, $header_present) **/ public static function getInstance($type) { + $allowedBackends = [ + 'csv' => PluginDatainjectionBackendcsv::class, + ]; - $class = 'PluginDatainjectionBackend' . $type; - if (!is_a($class, CommonDBTM::class, true)) { - throw new HttpException(500, 'Class ' . $class . ' is not a valid class'); + if (!isset($allowedBackends[$type])) { + throw new InvalidArgumentException("Unknown backend type: $type"); } - return new $class(); + + return new $allowedBackends[$type](); + + }