DoubleDoorDevelopment / CurseModpackDownloader

A java based Curse modpack downloader/installer. It can download Curse packs with mods that have been archived too!
https://cursemeta.dries007.net/
European Union Public License 1.1
16 stars 1 forks source link

Escape spaces in urls; Use response codes and handle relative locatio… #9

Closed TigerWalts closed 5 years ago

TigerWalts commented 5 years ago

…ns in url connection responses

A recent change to the CurseForge website has changed the location attribute of redirect responses from full URLs to just the URL path if the protocol and domain are the same as the request. getFinalURL fails to handle these redirects.

I have amended it to check the response code and if it is 200, then return the original request URL. If the response is in the 3XX range then the response location is checked for a leading slash and is prefixed with the request protocol and authority (domain:port). The loop will continue until a 200 is returned or the number of redirects is exceeded.

There is also quick fix for URLs with spaces in them.

CLAassistant commented 5 years ago

CLA assistant check
All committers have signed the CLA.

dries007 commented 5 years ago

@Claycorp I'm going to merge, it looks good, but can you please test it some before I update the backend?

TigerWalts commented 5 years ago

I'm already using a build with the changes, if I run into any cases where it fails, I'll look at it some more.

dries007 commented 5 years ago

We have a list of fun URLs somewhere curse somehow allows on their platform that usually cause issues, but I don't have the time to find it or test it, but I assume it works in all "normal" cases. Thanks for the pr btw.