You can clone with
HTTPS or Subversion.
Downloading reports started failing today in downloadReport. For some reason, my headers don't contain either 'Filename' or 'filename', so it fails with 'unexpected response'. Here is a dump of the headers, if it helps:
(gdb) po [downloadResponse allHeaderFields]
"Cache-Control" = private;
"Content-Encoding" = gzip;
"Content-Language" = "en-US";
"Content-Type" = "text/html;charset=ISO-8859-1";
Date = "Wed, 22 Jun 2011 06:06:25 GMT";
Server = "Apache-Coyote/1.1";
"Transfer-Encoding" = Identity;
"X-Powered-By" = "JSF/1.2";
Did more debugging and noticed that the HTTP POST in downloadReport isn't getting the CSV data, it's getting the Sales and Trends page. What's going on?
OK, figured out the problem. I needed to add the following POST field into the first dictionary in downloadReport:
Not sure if anyone else is running into this problem.
OK, found the source of the bug. In fetchReportsWithUserInfo:, the lines:
NSString *weeklyName = [dailyName stringByReplacingOccurrencesOfString:@"_6" withString:@"_22"];
NSString *ajaxName = [dailyName stringByReplacingOccurrencesOfString:@"_6" withString:@"_2"];
NSString *daySelectName = [dailyName stringByReplacingOccurrencesOfString:@"_6" withString:@"_43"];
NSString *weekSelectName = [dailyName stringByReplacingOccurrencesOfString:@"_6" withString:@"_48"];
are bad, because my dailyName is 'theForm:j_id_jsp_60478444_6'. These lines will replace BOTH occurrences of '_6' when the intention is to only replace the final occurrence. We should probably restrict the string replace with a range of just the final two characters of the string.
Added fix for issues #112 & #113
Awesome, thanks. We can probably clean that up a bit more by using stringByReplacingCharactersInRange:withString:
instead of stringByReplacingOccurrencesOfString:withString:options:range: since we know that the entire range needs to be replaced.