Skip to content

Conversation

@ThexXTURBOXx
Copy link

This is needed because webp files may be downloaded otherwise.
Now, the original file is actually retrieved.

let lossy_url = image["imageinfo"][0]["url"]
.as_str()
.ok_or_else(|| Error::Json(image.clone()))?;
let url = format!("{}{}format=original", lossy_url,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like we can probably add a line like this to make this simpler:

        request.arg("format", "original");

Probably add it around https://github.com/FTB-Gamepedia/mediawiki-rs/pull/8/changes#diff-b1a35a68f14e696205874893c07fd24fdb88882b47c23cc0e0c80a30c7d53759R152-R153 if I were to choose, but anywhere before the actual request happens should be fine.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The argument is not going on that request, because that's the request to get the image URL in the first place. It has to be added to the later request where we actually download the image.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that my approach of using format to append a string is not the best way. I have not done too much with Rust yet, so sorry if I don't know about every API method there is!
But yeah, @retep998 is right: the format=original parameter needs to be added to this request, not the one before, where only the JSON is being fetched

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants