mirror of
				https://github.com/Neocky/pluGET.git
				synced 2024-04-29 16:12:30 +00:00 
			
		
		
		
	Fixed error when searching for plugins
Changes: - fixed bug when searching for plugins where the name couldn't be sanitized - fixed bug when searching for plugins with numbers in name
This commit is contained in:
		| @@ -21,8 +21,11 @@ def handleRegexPackageName(packageNameFull): | |||||||
|         packageNameFull2 = packageNameFull.replace(unwantedpackageNameString, '') |         packageNameFull2 = packageNameFull.replace(unwantedpackageNameString, '') | ||||||
|     # gets the real packagename "word1 & word2" is not supported only gets word 1 |     # gets the real packagename "word1 & word2" is not supported only gets word 1 | ||||||
|     packageName = re.search(r'([a-zA-Z]\d*)+(\s?\-*\_*[a-zA-Z]\d*\+*\-*\'*)+', packageNameFull2) |     packageName = re.search(r'([a-zA-Z]\d*)+(\s?\-*\_*[a-zA-Z]\d*\+*\-*\'*)+', packageNameFull2) | ||||||
|     packageNameFullString = packageName.group() |     try: | ||||||
|     packageNameOnly = packageNameFullString.replace(' ', '') |         packageNameFullString = packageName.group() | ||||||
|  |         packageNameOnly = packageNameFullString.replace(' ', '') | ||||||
|  |     except AttributeError: | ||||||
|  |         packageNameOnly = unwantedpackageNameString | ||||||
|     return packageNameOnly |     return packageNameOnly | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -133,7 +136,11 @@ def getSpecificPackage(resourceId, downloadPath, inputPackageVersion='latest'): | |||||||
|         downloadPath = createTempPluginFolder() |         downloadPath = createTempPluginFolder() | ||||||
|     url = f"https://api.spiget.org/v2/resources/{resourceId}" |     url = f"https://api.spiget.org/v2/resources/{resourceId}" | ||||||
|     packageDetails = doAPIRequest(url) |     packageDetails = doAPIRequest(url) | ||||||
|     packageName = packageDetails["name"] |     try: | ||||||
|  |         packageName = packageDetails["name"] | ||||||
|  |     except KeyError: | ||||||
|  |         print(oColors.brightRed +  "Error: Plugin ID couldn't be found" + oColors.standardWhite) | ||||||
|  |         return None | ||||||
|     packageNameNew = handleRegexPackageName(packageName) |     packageNameNew = handleRegexPackageName(packageName) | ||||||
|     versionId = getVersionID(resourceId, inputPackageVersion) |     versionId = getVersionID(resourceId, inputPackageVersion) | ||||||
|     packageVersion = getVersionName(resourceId, versionId) |     packageVersion = getVersionName(resourceId, versionId) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Neocky
					Neocky