Skip to content

Commit

Permalink
fix mailhog/MailHog#113 - better RFC support for headers in UI
Browse files Browse the repository at this point in the history
  • Loading branch information
ian-kent committed Nov 14, 2016
1 parent c0c9ec9 commit c2d0e00
Show file tree
Hide file tree
Showing 2 changed files with 107 additions and 28 deletions.
117 changes: 93 additions & 24 deletions assets/assets.go

Large diffs are not rendered by default.

18 changes: 14 additions & 4 deletions assets/js/controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -487,9 +487,14 @@ mailhogApp.controller('MailCtrl', function ($scope, $http, $sce, $timeout) {
}
$scope.hasHTML = function(message) {
// TODO cache this
if (message.Content.Headers && message.Content.Headers["Content-Type"] && message.Content.Headers["Content-Type"][0].match("text/html")) {
return true;
for(var header in message.Content.Headers) {
if(header.toLowerCase() == 'content-type') {
if(message.Content.Headers[header][0].match("text/html")) {
return true
}
}
}

var l = $scope.findMatchingMIME(message, "text/html");
if(l != null && l !== "undefined") {
return true
Expand All @@ -498,9 +503,14 @@ mailhogApp.controller('MailCtrl', function ($scope, $http, $sce, $timeout) {
}
$scope.getMessageHTML = function(message) {
console.log(message);
if (message.Content.Headers && message.Content.Headers["Content-Type"] && message.Content.Headers["Content-Type"][0].match("text/html")) {
return $scope.tryDecode(message.Content);
for(var header in message.Content.Headers) {
if(header.toLowerCase() == 'content-type') {
if(message.Content.Headers[header][0].match("text/html")) {
return $scope.tryDecode(message.Content);
}
}
}

var l = $scope.findMatchingMIME(message, "text/html");
if(l != null && l !== "undefined") {
return $scope.tryDecode(l);
Expand Down

0 comments on commit c2d0e00

Please # to comment.