Minecraft Server Resouce Pack won’t download to client – java.net.MalformedURLException: no protocol

minecraft-java-editionminecraft-java-edition-server

I'm running a Minecraft server on a local host in my house (FreeNas with MineOS plugin). I've configured my server.properties file with this line

server.properties

resource-pack="https://www.dropbox.com/s/4nbkkrfmxkw6n82/DefaultHDv1_7.zip?dl=1"

When I hit that link from any browser, the file downloads. I place the link into my server.properties file and restart the server. It gets the proper \ (escape) treatment:

server.properties

resource-pack="https://www.dropbox.com/s/4nbkkrfmxkw6n82/DefaultHDv1_7.zip?dl\=1"

And when I connect to the server, I'm asked if I would like to download the resource pack. Well, yes I would! Click yes, and I see

Downloading Texture Pack

Making request… 0%

This is when I manually tested my download links from my in-house data connection and on my 4gLTE provider, both worked fine so Dropbox is sending the file when requested. Kept the MC launcher running so I could read console output and found this.

[22:04:14] [File Downloader #5/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: java.net.MalformedURLException: no protocol: "https://www.dropbox.com/s/4nbkkrfmxkw6n82/DefaultHDv1_7.zip?dl=1"
[21:46:36] [File Downloader #3/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: at java.net.URL.(URL.java:586)
[21:46:36] [File Downloader #3/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: at java.net.URL.(URL.java:483)
[21:46:36] [File Downloader #3/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: at java.net.URL.(URL.java:432)
[21:46:36] [File Downloader #3/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: at net.minecraft.util.HttpUtil$1.run(SourceFile:108)
[21:46:36] [File Downloader #3/INFO] [STDERR]: [java.lang.Throwable$WrappedPrintStream:println:748]: at java.lang.Thread.run(Thread.java:745)

I've tried making the URL an HTTP link instead of HTTPS (in the thought that 'no protocol' meant my local Java client couldn't hit an HTTPS URL for one or another reason) . This also allows download via browser, but still will not download via the Minecraft client.

Using this:

server.properties

resource-pack="http://www.dropbox.com/s/4nbkkrfmxkw6n82/DefaultHDv1_7.zip?dl=1"

The URL then gets transformed to this (the standard escape characters are added):

server.properties

resource-pack="http://www.dropbox.com/s/4nbkkrfmxkw6n82/DefaultHDv1_7.zip?dl\=1"

But still I get the same 'no protocol' message in all my MC client outputs. We're running MC 1.7.10, both client systems have Java 1.8 (jre-8u66) installed, and work absolutely great with the exception of this one bug.

Do I need to downgrade to 1.6 for this to function properly? I can't upgrade my MC version to 1.8+ as the mods we run in our game don't apply properly.

I've worked around it for now by just using a local respack, but I'd prefer to just get this working the way it should (and the way I want it to 🙂 )

Any help out there?

Best Answer

The user MorkPork had a similar issue in another question. He had the same error while trying to use a url contained in a string in . Another user m-szalik, responded with this answer:

You need to encode your parameter's values before concatenating them to a URL...

In another question, good asked which characters are not valid in a url. User Gumbo responded saying that the characters []@!$&'()*+,;= are all invalid. As m-szalik said, you must encode them. In the url you gave the only invalid character was =. I already encoded the equals symbol for you using a Url encoding site. The result was %3D. Once we replace the equals sign with the encoded equals sign, the result is:

https://www.dropbox.com/s/4nbkkrfmxkw6n82/DefaultHDv1_7.zip?dl%3D1
If you click that URL it works just the same as the old url.

Note: If that url does not work either you can also try encoding the entire url, which would result in http%3A%2F%2Fwww.dropbox.com%2Fs%2F4nbkkrfmxkw6n82%2FDefaultHDv1_7.zip%3Fdl%3D1, which is also a working Url.

I hope this helped.


Tip:
In a url a backslash is not enough to make it valid. This is because the backslash is an invalid character itself (However, forward slashes / are valid)


Sources:
Which Characters Make a Url Invalid? asked by good, answered by Gumbo.

Java.net.MalformedURLException: no protocol on URL based on a string modified with URLEncoder asked by MorkPork, answered by m-szalik.

Url-encode-decode.com. scripted and maintained by Dan from DansTools.com.

Related Topic