diff --git a/spec-nylas/stores/draft-store-spec.coffee b/spec-nylas/stores/draft-store-spec.coffee index 137cf8edf..e25fa9b3c 100644 --- a/spec-nylas/stores/draft-store-spec.coffee +++ b/spec-nylas/stores/draft-store-spec.coffee @@ -673,6 +673,22 @@ describe "DraftStore", -> DraftStore._onHandleMailtoLink('mailto:bengotow@gmail.com') expect(received.body.indexOf("Edited by TestExtension!")).toBe(0) + it "should be case-insensitive towards subject keys", -> + received = null + spyOn(DraftStore, '_finalizeAndPersistNewMessage').andCallFake (draft) -> + received = draft + Promise.resolve({draftLocalId: 123}) + + expected = "EmailSubjectLOLOL" + DraftStore._onHandleMailtoLink('mailto:asdf@asdf.com?subject=' + expected) + expect(received.subject).toBe(expected) + + DraftStore._onHandleMailtoLink('mailto:asdf@asdf.com?Subject=' + expected) + expect(received.subject).toBe(expected) + + DraftStore._onHandleMailtoLink('mailto:asdf@asdf.com?SUBJECT=' + expected) + expect(received.subject).toBe(expected) + it "should correctly instantiate drafts for a wide range of mailto URLs", -> received = null spyOn(DatabaseStore, 'persistModel').andCallFake (draft) -> diff --git a/src/flux/stores/draft-store.coffee b/src/flux/stores/draft-store.coffee index 4a939f262..83bf476e0 100644 --- a/src/flux/stores/draft-store.coffee +++ b/src/flux/stores/draft-store.coffee @@ -365,6 +365,9 @@ class DraftStore query = require('querystring').parse(query) query.to = to + for key, val of query + query[key.toLowerCase()] = val + draft = new Message body: query.body || '' subject: query.subject || '',