wesleytodd / YeoPress

A Yeoman generator for WordPress
Other
1.08k stars 163 forks source link

Problem with downloading language files #141

Open sribo23 opened 9 years ago

sribo23 commented 9 years ago

Due to a 302 redirect the language files can not be downloaded. The files are created but the content is an html file with the message '302 Found'.

wesleytodd commented 9 years ago

Can you be more specific? What url is it trying to download? Are there error messages? Stuff like that.

sribo23 commented 9 years ago

Sorry for the late reply! For an example, if you would do a curl request: curl http://translate.wordpress.org/projects/wp/dev/de/default/export-translations?format=mo then you would get this result:

<html>
<head><title>302 Found</title></head>
<body bgcolor="white">
<center><h1>302 Found</h1></center>
<hr><center>nginx</center>
</body>
</html>

But if you would do it again like so: curl -L http://translate.wordpress.org/projects/wp/dev/de/default/export-translations?format=mo then you will get the result. The 302 redirect will be accepted with this -L flag. This shows also that the file is behind a 302 redirect but http.get() method in https://github.com/wesleytodd/YeoPress/blob/master/util/wordpress.js:55 does not follow the redirect as curl does.

wesleytodd commented 9 years ago

Yeah, we should convert that to use request instead of the core http module. Marking this as a bug. Thanks!

If you are interested in getting it working it is as simple as using request to make the request. I would accept this PR and publish right away if you make it.