-
-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(get): file name is computed from the v2/resources/(resource_id) URL value #322
Comments
Actually, spiget support isn't yet converted over to mc-image-helper https://github.com/itzg/docker-minecraft-server/blob/master/scripts/start-spiget That's why the file naming algorithm is overly simplistic so far. When it is converted over the proper file naming can be used like the other retrieval logic here. |
I see, my bad for the overlook. I was watching the debug log and assumed the call to mc get meant it was doing the parsing, now I think I understand that it's being used to get the json path and start-spiget does the rest. Would it make sense to submit a PR that does the suggested enhancement on the dockerfile side or would this be futile since a proper implementation is planned here? |
Good question. Yeah, I'd prefer to put the effort into porting it fully to mc-image-helper. I'll try to take a quick go at that today. |
...ah, I remember now: I don't like Spiget's API. It is annoying that https://spiget.org/documentation/#!/resources/get_resources_resource_download redirects and downloads from Spiget's CDN whereas https://spiget.org/documentation/#!/resources/get_resources_resource_versions_version_download acts completely different and just redirects to spigotmc, which in turn responds with a 403 forbidden since they don't want automated downloads supported. I would prefer a cleaner/robust API usage of
Instead it's simply a blind download from the latest of that resource ID. To make matter worse:
Your suggestion of deriving from the file->url of the resource metadata does seem to be about the only solution, but that feels like it might be brittle. |
Feature request
Hello!
I suggest that the downloaded file name for a given resource is not
ID.jar
but instead computed from the ['file'] -> ['url'] key of the SPIGET API at thev2/resources/
+ ID endpoint.By extracting the filename between resource/ and /download in the value of the URL key, and sanitizing it (replace every non
[a-zA-Z0-9]
character by_
), this would transformID.jar
as 'example_name_ID.jar'.This change would have two benefits:
I tried to see if I could do this msyelf but Java is not my expertise at all. However, if you can pinpoint where this change needs to be made, I'll gladly do a PR once I work this out; if you agree with the idea.
Thanks! Keep up the great work.
The text was updated successfully, but these errors were encountered: