* [#1974] Uninstall extension completely on install failure * Add changelog entry --------- Co-authored-by: Mitchell Syer <Syer10@users.noreply.github.com>
This commit is contained in:
@@ -50,6 +50,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|||||||
- (**Source/API**) Fix handling of nullable preference keys (TYPE "preferences")
|
- (**Source/API**) Fix handling of nullable preference keys (TYPE "preferences")
|
||||||
- (**Source**) Fix local manga thumbnails handling
|
- (**Source**) Fix local manga thumbnails handling
|
||||||
- (**Extension**) Fix missing icon for manually installed source
|
- (**Extension**) Fix missing icon for manually installed source
|
||||||
|
- (**Extension**) Fix installation retry always fails
|
||||||
- (**Extension**) Fixed a java.lang.VerifyError when installing an extension that has ProGuard enabled.
|
- (**Extension**) Fixed a java.lang.VerifyError when installing an extension that has ProGuard enabled.
|
||||||
- (**Backup**) Fix importing of backups with missing server settings
|
- (**Backup**) Fix importing of backups with missing server settings
|
||||||
- (**Backup**) Fix importing of backups with invalid server settings
|
- (**Backup**) Fix importing of backups with invalid server settings
|
||||||
|
|||||||
@@ -119,7 +119,6 @@ object Extension {
|
|||||||
|
|
||||||
val dirPathWithoutType = "${applicationDirs.extensionsRoot}/$fileNameWithoutType"
|
val dirPathWithoutType = "${applicationDirs.extensionsRoot}/$fileNameWithoutType"
|
||||||
val jarFilePath = "$dirPathWithoutType.jar"
|
val jarFilePath = "$dirPathWithoutType.jar"
|
||||||
val dexFilePath = "$dirPathWithoutType.dex"
|
|
||||||
|
|
||||||
val packageInfo = getPackageInfo(apkFilePath)
|
val packageInfo = getPackageInfo(apkFilePath)
|
||||||
val pkgName = packageInfo.packageName
|
val pkgName = packageInfo.packageName
|
||||||
@@ -163,8 +162,8 @@ object Extension {
|
|||||||
|
|
||||||
// clean up
|
// clean up
|
||||||
File(apkFilePath).delete()
|
File(apkFilePath).delete()
|
||||||
File(dexFilePath).delete()
|
|
||||||
|
|
||||||
|
try {
|
||||||
// collect sources from the extension
|
// collect sources from the extension
|
||||||
val extensionMainClassInstance = loadExtensionSources(jarFilePath, className)
|
val extensionMainClassInstance = loadExtensionSources(jarFilePath, className)
|
||||||
val sources: List<CatalogueSource> =
|
val sources: List<CatalogueSource> =
|
||||||
@@ -228,6 +227,14 @@ object Extension {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 201 // we installed successfully
|
return 201 // we installed successfully
|
||||||
|
} catch (e: Throwable) {
|
||||||
|
// free up the file descriptor if exists
|
||||||
|
PackageTools.jarLoaderMap.remove(jarFilePath)?.close()
|
||||||
|
File(jarFilePath).delete()
|
||||||
|
|
||||||
|
uninstallExtension(pkgName)
|
||||||
|
throw e
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return 302 // extension was already installed
|
return 302 // extension was already installed
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user