mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-10-31 13:15:43 +00:00 
			
		
		
		
	fix path prefixes
This commit is contained in:
		| @@ -35,7 +35,19 @@ def get_plugin_error(error, do_raise: bool = False, do_log: bool = False, log_na | ||||
|     try: | ||||
|         package_name = pathlib.Path(package_path).relative_to(install_path).parts[0] | ||||
|     except ValueError: | ||||
|         package_name = pathlib.Path(package_path).relative_to(settings.BASE_DIR) | ||||
|         # is file - loaded -> form a name for that | ||||
|         path_obj = pathlib.Path(package_path).relative_to(settings.BASE_DIR) | ||||
|         path_parts = [*path_obj.parts] | ||||
|         path_parts[-1] = path_parts[-1].replace(path_obj.suffix, '')  # remove suffix | ||||
|  | ||||
|         # remove path preixes | ||||
|         if path_parts[0] == 'plugin': | ||||
|             path_parts.remove('plugin') | ||||
|             path_parts.pop(0) | ||||
|         else: | ||||
|             path_parts.remove('plugins') | ||||
|  | ||||
|         package_name = '.'.join(path_parts) | ||||
|  | ||||
|     if do_log: | ||||
|         log_kwargs = {} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user