diff --git a/libmproxy/web/static/js/app.js b/libmproxy/web/static/js/app.js index 01c14ddce..b86e462a0 100644 --- a/libmproxy/web/static/js/app.js +++ b/libmproxy/web/static/js/app.js @@ -690,13 +690,13 @@ var IconColumn = React.createClass({displayName: 'IconColumn', icon = "resource-icon-not-modified"; } else if(300 <= flow.response.code && flow.response.code < 400) { icon = "resource-icon-redirect"; - } else if(contentType.indexOf("image") >= 0) { + } else if(contentType && contentType.indexOf("image") >= 0) { icon = "resource-icon-image"; - } else if (contentType.indexOf("javascript") >= 0) { + } else if (contentType && contentType.indexOf("javascript") >= 0) { icon = "resource-icon-js"; - } else if (contentType.indexOf("css") >= 0) { + } else if (contentType && contentType.indexOf("css") >= 0) { icon = "resource-icon-css"; - } else if (contentType.indexOf("html") >= 0) { + } else if (contentType && contentType.indexOf("html") >= 0) { icon = "resource-icon-document"; } } @@ -763,9 +763,11 @@ var SizeColumn = React.createClass({displayName: 'SizeColumn', }, render: function(){ var flow = this.props.flow; - var size = formatSize( - flow.request.contentLength + - (flow.response.contentLength || 0)); + var total = flow.request.contentLength; + if(flow.response){ + total += flow.response.contentLength; + } + var size = formatSize(total); return React.DOM.td({className: "col-size"}, size); } }); diff --git a/web/src/js/components/flowtable-columns.jsx.js b/web/src/js/components/flowtable-columns.jsx.js index 728bc9535..ec63b03fc 100644 --- a/web/src/js/components/flowtable-columns.jsx.js +++ b/web/src/js/components/flowtable-columns.jsx.js @@ -39,13 +39,13 @@ var IconColumn = React.createClass({ icon = "resource-icon-not-modified"; } else if(300 <= flow.response.code && flow.response.code < 400) { icon = "resource-icon-redirect"; - } else if(contentType.indexOf("image") >= 0) { + } else if(contentType && contentType.indexOf("image") >= 0) { icon = "resource-icon-image"; - } else if (contentType.indexOf("javascript") >= 0) { + } else if (contentType && contentType.indexOf("javascript") >= 0) { icon = "resource-icon-js"; - } else if (contentType.indexOf("css") >= 0) { + } else if (contentType && contentType.indexOf("css") >= 0) { icon = "resource-icon-css"; - } else if (contentType.indexOf("html") >= 0) { + } else if (contentType && contentType.indexOf("html") >= 0) { icon = "resource-icon-document"; } } @@ -112,9 +112,11 @@ var SizeColumn = React.createClass({ }, render: function(){ var flow = this.props.flow; - var size = formatSize( - flow.request.contentLength + - (flow.response.contentLength || 0)); + var total = flow.request.contentLength; + if(flow.response){ + total += flow.response.contentLength; + } + var size = formatSize(total); return {size}; } });