Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Case insensitive Content-Type not handled as html #20

Closed
fliespl opened this issue Jul 21, 2016 · 5 comments
Closed

Case insensitive Content-Type not handled as html #20

fliespl opened this issue Jul 21, 2016 · 5 comments
Labels

Comments

@fliespl
Copy link

fliespl commented Jul 21, 2016

If mailer uses content-type, Content-type instead of Content-Type message will not be displayed as html since case sensitive key match is being used in controller.js.

@ian-kent
Copy link
Member

I think this is the same as mailhog/MailHog#113, and should be fixed by c2d0e00

Let me know if it's still broken after the next release

@ian-kent ian-kent added the bug label Nov 15, 2016
@123andy
Copy link

123andy commented Aug 6, 2017

Hi @ian-kent - The case sensitivity of the header keys is still an issue. It appears the code uses Content-Type explicitly in numerous places:

Perhaps instead of the patch above, a fix that modifies the message.Content.Headers['keys'] to be of the proper format on parse would be easier:

for(var header in message.Content.Headers) {
	if(header.toLowerCase() == 'content-type' && header != 'Content-Type') {
		message.Content.Headers['Content-Type'] = message.Content.Headers[header];
		delete message.Content.Headers[header];
		break;
	}
}

Or, perhaps just make all titlecase:

for(var header in message.Content.Headers) {
  var parts = header.split("-");
  for (var part in parts) {
    var s = parts[part];
    parts[part] = s.charAt(0).toUpperCase() + s.substr(1).toLowerCase();
  }
  var newHeader = parts.join("-");
  if(header =! newHeader) {
    message.Content.Headers[newHeader] = message.Content.Headers[header];
    delete message.Content.Headers[header];
  }
}

@webprogrammierer
Copy link

The problem still exist. Why can't this be solved?

@dimitropoulos
Copy link

@ian-kent since you asked, just wanted to let you know that it's still an issue

@webprogrammierer
Copy link

For years

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants