snyk 1.861.0 → 1.862.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2954,8 +2954,15 @@ const config_1 = __webpack_require__(22541);
2954
2954
  const debug = debugLib('snyk-detect');
2955
2955
  const requiredK8SObjectFields = ['apiVersion', 'kind', 'metadata'];
2956
2956
  function getFileType(filePath) {
2957
- const filePathSplit = filePath.split('.');
2958
- return filePathSplit[filePathSplit.length - 1].toLowerCase();
2957
+ try {
2958
+ const index = filePath.lastIndexOf('.'); // it will be -1 if it doesn't contain a dot
2959
+ if (index !== -1)
2960
+ return filePath.slice(index + 1).toLowerCase();
2961
+ }
2962
+ catch (e) {
2963
+ // ignore errors if we can't extract the filetype
2964
+ }
2965
+ return '';
2959
2966
  }
2960
2967
  exports.getFileType = getFileType;
2961
2968
  function parseFileContent(fileContent, filePath) {