Two bugs were found and addressed. The first bug happened while trying to upload a link. I dropped a URL on the Uploader and the app got stuck in the “Thinking” phase. After some troubleshooting, I noticed the page for the URL did not have a <title> tag so the app was sending the PHP page an empty ‘name’ variable causing the PHP page to stop executing during the validation phase. The fix was to assign a default name to the link if no title tag is present. In these cases, I’ll manually give the link a proper title.
The second issue also had to do with the <title> tag. In this case, the HTML did have a title tag but the case was different that what I was looking for. My code was looking for all lowercase characters and the tag in the HTML was in uppercase. My first thought was to do a .toLowerCase() on the HTML code but then all the titles would be in lower case and wouldn’t look as presentable (ex: the size of our planet vs The Size of Our Planet). After giving this some more thought, it seemed using regex would be the cleanest solution. A quick Google search returned this page which said by adding an ‘i’ to the end of my regex, the search would be case insensitive. I gave it a try and it worked like a charm.
var start:Number = s.indexOf('<title>'); var end:Number = s.indexOf('</title>'); var title:String = s.substr(start + 7, end - start - 7);
var start:Number = s.search(/<title>/i); var end:Number = s.search(/<\/title>/i); var title:String = s.substr(start + 7, end - start - 7);