Skip to content
This repository was archived by the owner on Dec 30, 2022. It is now read-only.

Commit 8a8eea4

Browse files
authored
Merge pull request #73 from DeathsGun/bugs/invalid_asset_url
Fixed tabs in urls producing errors
2 parents c9f7e76 + 6b2696f commit 8a8eea4

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/main/kotlin/xyz/deathsgun/modmanager/update/UpdateManager.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -271,12 +271,13 @@ class UpdateManager {
271271
val expected = asset.hashes["sha512"]
272272
val calculated = jar.sha512()
273273
if (calculated != expected) {
274+
logger.error("The SHA-512 hashes do not match expected {} but got {}", expected, calculated)
275+
jar.delete()
276+
logger.error("Deleting {}", jar.absolutePathString())
274277
return ModUpdateResult.Error(
275278
TranslatableText(
276279
"modmanager.error.invalidHash",
277-
"SHA-512",
278-
expected,
279-
calculated
280+
"SHA-512"
280281
)
281282
)
282283
}
@@ -416,7 +417,7 @@ class UpdateManager {
416417
}
417418

418419
private fun encodeURI(url: String): String {
419-
return URI("dummy", url, null).rawSchemeSpecificPart
420+
return URI("dummy", url.replace("\t", ""), null).rawSchemeSpecificPart
420421
}
421422

422423
}

src/main/resources/assets/modmanager/lang/en_us.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"modmanager.error.failedToParse": "Failed to parse response:\n %s",
4242
"modmanager.error.noCompatibleModVersionFound": "No compatible version found for your current channel!\nTry changing the channel in the Mod Manager settings!",
4343
"modmanager.error.jar.notFound": "Error jar file not found. Is it part of another mod?",
44+
"modmanager.error.invalidHash": "Error the downloaded file is probably broken as the %s hashes don't match\nTry checking your network or contact the mod author",
4445
"modmanager.status.installing": "Installing %s...",
4546
"modmanager.status.install.success": "Successfully installed %s!\nDo you want to go back?",
4647
"modmanager.status.updating": "Updating %s...",

0 commit comments

Comments
 (0)