Closed Bug 23894 Opened 25 years ago Closed 25 years ago

Cannot save attachment if name contains a quote (')

Categories

(MailNews Core :: MIME, defect, P3)

PowerPC
Mac System 8.5
defect

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: bugzilla, Assigned: mscott)

Details

If I receive a message with a file attached to it and the attachment name contains some special characteres like a
quote, you cannot save it when you clik on the attachment icon. We get the following JS error:

JavaScript Error: illegal character
Line text: 'OpenAttachURL('imap%3A//qatest03%40nsmail-2%3A143/fetch%3EUID%3E/INBOX%3E634%3Fpart%3D1.2',
'l'ÈtÈ.txt', 'imap_message://qatest03@nsmail-2/INBOX#634')'

I don't know if this bug if for jefft or for rhp.
Summary: Cannot save attachment if name contains an quote (') → Cannot save attachment if name contains a quote (')
QA Contact: lchiang → pmock
Status: NEW → ASSIGNED
Target Milestone: M13
Ok guys, what is the "right" fix for this. The problem is that when we have
characters like ' or " in a filename, it breaks the JS syntax. Is there a way
to safeguard the JS to ignore what is in the string, or do we have to escape it
before we pass it into JS?

Just wondering what the right change goes.

- rhp
Hi Naoki,
I need to escape a unicode string. Is there a function that would allow me to
do this?

Also, mscott: I think what we need to do is escape the string in the emitter
and then unescape it in JS. That's what Jeff and I were thinking made sense.

- rhp
Rich, I have a fix for this in my tree. You can re-assign this to me if you want.

You definetly don't want to escape the string in the mime emitter because then
the attachment won't display correctly! The display name will be escaped which
isn't correct.

In JS you can escape a string by calling escape(string).

I also had to unescape it in messenger.

I'll check it in when the tree opens.

I set up a test case and it works.
Assignee: rhp → mscott
Status: ASSIGNED → NEW
Over to you Scott!

- rhp
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Fix checked in.
Linux (2000-03-09-08 M14)
Win32 (2000-03-08-13 M14)
Mac  (2000-03-07-08 M14)mozilla

This problem has been fixed.

Using previous Mac build because 3/8 and 3/9 Mac builds are broken.
Status: RESOLVED → VERIFIED
Product: MailNews → Core
Product: Core → MailNews Core
You need to log in before you can comment on or make changes to this bug.