SKCraft / Launcher

🚀 Distribute your Minecraft modpacks with a custom launcher
Other
617 stars 431 forks source link

Have Launcher/Creator Tools/Etc handle URLs with spaces and other uncommon names correctly #223

Open 100chilly opened 6 years ago

100chilly commented 6 years ago

I've noticed that trying to download mods with spaces or other symbols in the name result the client to error out.

Examples: Botania r1.10-352.jar Pam's HarvestCraft 1.12.2a.jar BiblioCraft[v2.4.3][MC1.12.0].jar The Beneath-1.12.2-1.3.0.jar CreativeCore v1.9.12 mc1.12.2.jar OnlinePicFrame v1.4.14 mc1.12.2.jar

Out of all my mods that download from curse, these 6 fail with

java.io.IOException: Did not get expected response code, got 404 for https://addons-origin.cursecdn.com
    at com.skcraft.launcher.util.HttpRequest.expectResponseCode(HttpRequest.java:169)
    at com.skcraft.launcher.install.HttpDownloader$HttpDownloadJob.download(HttpDownloader.java:252)
    at com.skcraft.launcher.install.HttpDownloader$HttpDownloadJob.download(HttpDownloader.java:229)
    at com.skcraft.launcher.install.HttpDownloader$HttpDownloadJob.run(HttpDownloader.java:202)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

Ultimately if every Modder followed a set naming rule that removed spaces and symbols like [ | ] etc we wouldn't have any issues like this.

100chilly commented 6 years ago

They work in a normal web browser but the client just seems to dislike the urls.

spannerman79 commented 6 years ago

URLs can only be sent over the Internet using the ASCII character-set.

Many of modern days browsers step in and convert unsafe ASCII characters automatically - that is why they work in normal browsers.

For example the last one (OnlinePicFrame) URL becomes https://addons-origin.cursecdn.com/files/2500/607/OnlinePicFrame%20v1.4.14%20mc1.12.2.jar once URL encoded correctly.

100chilly commented 6 years ago

@spannerman79 yeah I figured but we have the correct/safe url inputted into the url.txt but the launcher fails to download still. Any ideas why?

spannerman79 commented 6 years ago
--2017-12-13 08:43:51--  https://addons-origin.cursecdn.com/files/2500/607/OnlinePicFrame%20v1.4.14%20mc1.12.2.jar
Resolving addons-origin.cursecdn.com (addons-origin.cursecdn.com)... 54.230.133.101
Connecting to addons-origin.cursecdn.com (addons-origin.cursecdn.com)|54.230.133.101|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 75639 (74K) [application/java-archive]
Saving to: ‘OnlinePicFrame v1.4.14 mc1.12.2.jar’

OnlinePicFrame v1.4.14  100%[=================================>]  73.87K  --.-KB/s   in 0.006s 

2017-12-13 08:43:52 (12.6 MB/s) - ‘OnlinePicFrame v1.4.14 mc1.12.2.jar’ saved [75639/75639]

That is the output of wget on my end - so the "unknown response" that is listed in your error needs to be found out yourself. I cannot do it as I get a http response of 200.

sk89q commented 6 years ago

I'll check it out tonight if I don't forget.

100chilly commented 6 years ago

@sk89q @spannerman79 Thank you both, I appreciate it. I'll keep an eye out for a reply. 😄

spannerman79 commented 6 years ago

Another "launcher" has pointed out that the Curse platform does not use valid URLs according to RFC 3986, section 2.1 by including spaces and UTF-8 characters without percent encoding them.

So this is in fact a Curse issue (technically mod devs for the stupid as f* file naming as well as Curse for letting them get away with it)

miiichael commented 3 years ago

Another example: Round-Trees-5.0-§31.16.2-§o.zip

If I leave it as-is in url.txt, curse naturally complains about the non-ASCII characters in the URL with HTTP400. But if I try to escape the §'s myself, then my %'s get escaped, and 404s ensue.

So whatever is trying to url-escape the contents of url.txt files isn't doing it right (eg. it escapes % but not §). I don't think it's an issue with Curseforge using "wrong" URLs, or mod devs using "wrong" filenames.

hedgehog1029 commented 3 years ago

I think the problems on Curse's side that previously caused this issue have been cleaned up, and now there's a persistent issue on our side.