Skip to content

Commit

Permalink
Merge remote branch 'jsmecham/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Muldowney committed Apr 13, 2011
2 parents bb0bcba + 665282b commit cf1d8aa
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Connectors/GoogleContacts/gcontacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def updateAll(self):
os.makedirs("photos")
except OSError:
pass
sys.stdout.write("Checking for udpates since %s" % (str(self.lastUpdate)))
sys.stdout.write("Checking for updates since %s" % (str(self.lastUpdate)))
sys.stdout.flush()
self.gd_client.ProgrammaticLogin()
self.write_groups_feed_to_file()
Expand Down
38 changes: 28 additions & 10 deletions Ops/Dashboard/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,36 @@ app.get('/*', function (req, res) {
return;
}

fs.readFile(filename, "binary", function(err, file) {
if(err) {
res.writeHead(500, {"Content-Type": "text/plain"});
res.write(err + "\n");
res.end();
return;
fs.readFile(filename, "binary", function(err, file) {
if(err) {
res.writeHead(500, {"Content-Type": "text/plain"});
res.write(err + "\n");
res.end();
return;
}

res.writeHead(200);
res.write(file, "binary");
res.end();
});
var fileExtension = filename.substring(filename.lastIndexOf(".") + 1);
var contentType, contentLength;

switch (fileExtension)
{
case "png": contentType = "image/png"; break;
case "jpg": contentType = "image/jpeg"; break;
case "gif": contentType = "image/gif"; break;
}

if (contentType)
{
res.writeHead(200, { "Content-Type": contentType });
res.write(file);
}
else
{
res.writeHead(200);
res.write(file, "binary");
}
res.end();
});
});
});

Expand Down

0 comments on commit cf1d8aa

Please sign in to comment.