Closed
Bug 1284004
Opened 8 years ago
Closed 8 years ago
Improve remote attachment handling
Categories
(Thunderbird :: Message Reader UI, defect)
Thunderbird
Message Reader UI
Tracking
(Not tracked)
RESOLVED
FIXED
Thunderbird 51.0
People
(Reporter: alta88, Assigned: alta88)
References
Details
Attachments
(4 files, 5 obsolete files)
(deleted),
text/plain
|
Details | |
(deleted),
patch
|
alta88
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
mkmelin
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
alta88
:
review+
|
Details | Diff | Splinter Review |
Remote urls may contain ? query strings in the url, in addition to ?part=. This is not handled by the PART_RE regex, leading to incorrect counts in attachment pane as well as the MsgHdrToMimeMessage api.
Test mbox with 2 feed items, one with content-type unknown, the second with content-type image/jpeg (to demonstrate inline display).
Assignee: nobody → alta88
Attachment #8767415 -
Flags: review?(mkmelin+mozilla)
Attachment #8767415 -
Flags: feedback?(jonathan.protzenko)
Part 2 - have libmime pass on a remote link's reported size to the header sink so it can be displayed like for internal/file attachments.
Attachment #8767751 -
Flags: review?(mkmelin+mozilla)
tweak for file urls already sized.
Attachment #8767751 -
Attachment is obsolete: true
Attachment #8767751 -
Flags: review?(mkmelin+mozilla)
Attachment #8767778 -
Flags: review?(mkmelin+mozilla)
Comment 5•8 years ago
|
||
Comment on attachment 8767415 [details] [diff] [review]
feedEnclosure.patch
Review of attachment 8767415 [details] [diff] [review]:
-----------------------------------------------------------------
::: mail/base/content/msgHdrViewOverlay.js
@@ +1785,5 @@
> // Remove [?&]part= from remote urls, after getting the partID.
> + // Remote urls, unlike non external mail part urls, may also contain query
> + // strings starting with ?; PART_RE does not handle this.
> + if (url.startsWith("http") || url.startsWith("file")) {
> + match = url.match(/[?&]part=[^part=]+$/);
shouldn't this be something like
match = url.match(/[?&]part=[^&]+$/);
Comment 6•8 years ago
|
||
Comment on attachment 8767778 [details] [diff] [review]
attachmentLen.patch
Review of attachment 8767778 [details] [diff] [review]:
-----------------------------------------------------------------
::: mail/base/content/msgHdrViewOverlay.js
@@ +641,3 @@
> !last.isDeleted) {
> let size = parseInt(value);
> +dump("addAttachmentField: external size:value - "+size+":"+value+"\n");
left over debug dump should go of course
Attachment #8767778 -
Flags: review?(mkmelin+mozilla) → review+
(In reply to Magnus Melin from comment #5)
> Comment on attachment 8767415 [details] [diff] [review]
> feedEnclosure.patch
>
> Review of attachment 8767415 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> ::: mail/base/content/msgHdrViewOverlay.js
> @@ +1785,5 @@
> > // Remove [?&]part= from remote urls, after getting the partID.
> > + // Remote urls, unlike non external mail part urls, may also contain query
> > + // strings starting with ?; PART_RE does not handle this.
> > + if (url.startsWith("http") || url.startsWith("file")) {
> > + match = url.match(/[?&]part=[^part=]+$/);
>
> shouldn't this be something like
>
> match = url.match(/[?&]part=[^&]+$/);
the idea was to not match "part=" other than the real "?part=1.2$", eg, that always ends the string. it seems like [^&] is not be enough for, eg,
http://myurl.com?part=foo?part=1.2
did you mean [^&?]; that probably works (but seems less sure in a way i can't make up an example for).
Comment 8•8 years ago
|
||
But that url isn't valid, the second ? would have to be encoded. (Or rather, it would be an &)
updated.
Attachment #8767415 -
Attachment is obsolete: true
Attachment #8767415 -
Flags: review?(mkmelin+mozilla)
Attachment #8767415 -
Flags: feedback?(jonathan.protzenko)
Attachment #8772975 -
Flags: review?(mkmelin+mozilla)
Assignee | ||
Comment 10•8 years ago
|
||
updated.
Attachment #8767778 -
Attachment is obsolete: true
Attachment #8772976 -
Flags: review+
Assignee | ||
Comment 11•8 years ago
|
||
also update jsmimeemitter.js part.
Attachment #8772975 -
Attachment is obsolete: true
Attachment #8772975 -
Flags: review?(mkmelin+mozilla)
Attachment #8772978 -
Flags: review?(mkmelin+mozilla)
Assignee | ||
Comment 12•8 years ago
|
||
ping?
Comment 14•8 years ago
|
||
Sorry, probably won't get to it until next week.
Updated•8 years ago
|
Attachment #8772978 -
Flags: review?(mkmelin+mozilla) → review+
Keywords: checkin-needed
Comment 15•8 years ago
|
||
https://hg.mozilla.org/comm-central/rev/d74812cfa1c0
https://hg.mozilla.org/comm-central/rev/9294fb7e2811
Status: NEW → RESOLVED
Closed: 8 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 51.0
Comment 16•8 years ago
|
||
Looks like this broke some tests:
TEST-UNEXPECTED-FAIL | mailnews/mime/test/unit/test_attachment_size.js | xpcshell return code: 0
TEST-UNEXPECTED-FAIL | mailnews/mime/test/unit/test_attachment_size.js | gStreamListener.onStopRequest - [gStreamListener.onStopRequest : 199] false == true
Backout or can you fix it quickly?
Flags: needinfo?(alta88)
Assignee | ||
Comment 17•8 years ago
|
||
thanks for asking, but not right now, pls backout.
Flags: needinfo?(alta88)
Comment 18•8 years ago
|
||
https://hg.mozilla.org/comm-central/rev/d9ab6d03bab9741b48700feb09c0f05a65883054
Backed out changeset 9294fb7e2811 (bug 1284004) for test failures.
https://hg.mozilla.org/comm-central/rev/f94907eab997537c91c3657836b13dacc54e1deb
Backed out changeset d74812cfa1c0 (bug 1284004) for test failures.
Updated•8 years ago
|
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Comment 19•8 years ago
|
||
Just for the record: Test failures for example here:
https://treeherder.mozilla.org/#/jobs?repo=comm-central&selectedJob=43497
Assignee | ||
Comment 20•8 years ago
|
||
simply need to initialize m_isExternalLinkAttachment, as random bits in the memory location incorrectly evaluate to true in an uncommon code path. tests too. all pass on a debug build.
Attachment #8778717 -
Flags: review?(mkmelin+mozilla)
Comment 21•8 years ago
|
||
Comment on attachment 8778717 [details] [diff] [review]
fixAndTests.patch
Review of attachment 8778717 [details] [diff] [review]:
-----------------------------------------------------------------
r=mkmelin with the below changed
::: mailnews/compose/public/nsMsgAttachmentData.h
@@ +54,5 @@
>
> int32_t m_size; // The size of the attachment. May be 0.
> nsCString m_sizeExternalStr; // The reported size of an external attachment. Originally set at "-1" to mean an unknown value.
> bool m_isExternalAttachment; // Flag for determining if the attachment is external
> + bool m_isExternalLinkAttachment = false; // Flag for determining if the attachment is external and an http link.
It should probably be initialized here instead:
https://dxr.mozilla.org/comm-central/source/mailnews/compose/src/nsMsgSend.cpp#4953
(and change m_isExternalAttachment(0) to m_isExternalAttachment(false) while you're at it)
::: mailnews/mime/test/unit/test_attachment_size.js
@@ +233,5 @@
> var gMessageHeaderSink = {
> handleAttachment: function(aContentType, aUrl, aDisplayName, aUri,
> aIsExternalAttachment) {
> + dump("*** handleAttachment: aContentType:aDisplayName:aIsExternalAttachment:aUrl - "+
> + aContentType+":"+aDisplayName+":"+aIsExternalAttachment+":"+aUrl+"\n\n");
this should be removed of course
Attachment #8778717 -
Flags: review?(mkmelin+mozilla) → review+
Assignee | ||
Comment 22•8 years ago
|
||
updated.
Attachment #8778717 -
Attachment is obsolete: true
Attachment #8779099 -
Flags: review+
Assignee | ||
Comment 23•8 years ago
|
||
the fixAndTests.patch should be applied last, thanks.
Keywords: checkin-needed
Comment 24•8 years ago
|
||
https://hg.mozilla.org/comm-central/rev/294c2e76579a
https://hg.mozilla.org/comm-central/rev/dcba7b05f616
https://hg.mozilla.org/comm-central/rev/512d3c0a11d2
Status: REOPENED → RESOLVED
Closed: 8 years ago → 8 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•