Closed Bug 1671835 Opened 4 years ago Closed 3 years ago

cloudfile.onFileUpload contains wrong fileName if attachment was renamed or forwarded

Categories

(Thunderbird :: FileLink, defect)

defect

Tracking

(thunderbird_esr78 wontfix)

RESOLVED FIXED
91 Branch
Tracking Status
thunderbird_esr78 --- wontfix

People

(Reporter: je, Assigned: je)

Details

Attachments

(2 files, 1 obsolete file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0

Steps to reproduce:

  1. Add an attachment to a message
  2. Rename it
  3. Upload it to a Filelink provider ("Convert to..." in the context menu)

Actual results:

The onFileUpload event is triggered, with a CloudFile object as the second parameter.
The name property of this CloudFile object contains the original name of the file attached. But the text inserted into the message along with the download url contains the new name.
So the name of the file in the cloud differs from the one in the message. This causes confusion or even security concerns for the receiver of the message.

Expected results:

The name property of the CloudFile object in the onFileUpload event should contain the new name (the one the attachment was renamed to).

I've attached the file '''original_name.txt''' and renamed it to renamed_name.txt

Status: UNCONFIRMED → NEW
Ever confirmed: true

There is another symptom of this bug:

  1. Receive a file called "sample.txt" as a regular attachent
  2. Choose to forward that message
  3. Convert the attachment to a Filelink attachment

The uploaded file now has a name like "nsmail.txt".

Again the problem is that the name property of the Cloudfile parameter in the onFileUpload does not contain the correct name of the attachment as eg returned by messenger.compose.listAttachments. Instead it contains the name of the local file.

Attached patch bug1671835.patch (obsolete) — Splinter Review

Untested (as I can't get a dev env up). I have no idea if this passes any quality checks but it seems to solve the problem.

Assignee: nobody → je
Status: NEW → ASSIGNED
Attachment #9224020 - Flags: review?(geoff)
Attachment #9224020 - Attachment is obsolete: true
Attachment #9224020 - Flags: review?(geoff)

Fixes both symptoms and tests pass.

Attachment #9224094 - Flags: review?(geoff)
Summary: cloudfile.onFileUpload contains wrong fileName → cloudfile.onFileUpload contains wrong fileName if attachment was renamed
Summary: cloudfile.onFileUpload contains wrong fileName if attachment was renamed → cloudfile.onFileUpload contains wrong fileName if attachment was renamed or forwarded

Comment on attachment 9224094 [details] [diff] [review]
Adds attachment.name to uploadFile

Looks good! Thanks for the patch, sorry it took a while to get around to the review.

Attachment #9224094 - Flags: review?(geoff) → review+
Target Milestone: --- → 91 Branch

Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/f56d4c959b5d
add attachment name to uploadFile() so that cloudfile will use correct name when attachment is renamed of forwarded. r=darktrojan

Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: