Jump to content
McKay Development

[important] "bug" in steamstore module.


Recommended Posts

Posted

Hey.

 

I just noticed there is pretty important bug in the steamstore module.

SteamStore.prototype.hasPhone = function(callback) {
	var self = this;
	this.request.get("https://store.steampowered.com/account/", function(err, response, body) {
		if(self._checkHttpError(err, response, callback)) {
			return;
		}

		var $ = Cheerio.load(body);
		var $phone = $('.phone_header_description .account_data_field');
		var match;

		if($phone && (match = $phone.text().match(/Ends in (\d+)/))) {
			// Has phone number
			callback(null, true, match[1]);
			return;
		}

		// See if we have an add-number link
		if($('a[href*="/phone/add"]').length) {
			callback(null, false);
			return;
		}

		callback(new Error("Malformed response: " + body));
	});
};

I modified it a bit so it returns body when malformed response happens.

 

The bug is that it is not matching account with language set not to english.

Example:

<div class="phone_header_description">
 								Telefon:
 								<img src="https://steamstore-a.akamaihd.net/public/images/mobile/icon_mobile.png" alt="" >
 								<span class="account_data_field">Kończy się na 01</span>
 							</div>

steamstore fails and returns "Malformed response"

 

easy fix: use /([0-9]{2})/ regex instead of this. 

 

I hope it will be patched soon. I've just submitted GitHub poll request.

 

Thank you!

~expl0it

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...