Closed Bug 314231 Opened 20 years ago Closed 20 years ago

If link target URL has non-ASCII char that is not encoded by UTF-8, the default file name is always escaped at "Save Link Target As..."

Categories

(SeaMonkey :: UI Design, defect, P1)

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: masayuki, Assigned: masayuki)

References

()

Details

(4 keywords)

Attachments

(1 file, 2 obsolete files)

If link target URL has non-ASCII char that is not encoded by UTF-8, the default file name is always escaped at "Save Link Target As..." The test case is here. http://bugzilla.mozilla.gr.jp/attachment.cgi?id=2931&action=view You may look Japanese default file name only on the "href has encoded by UTF-8". On other links, you can look the escaped default file name. # This is SeaMonkey version of bug 314222
Attached patch Patch rv1.0 (obsolete) — Splinter Review
This fix this bug. aDocument is always null in initFileInfo if it's called by "Save Link Target As...". We should use current document charset instead of aDocument's charset if aDocument is null.
Attachment #201159 - Flags: superreview?(neil.parkwaycc.co.uk)
Attachment #201159 - Flags: review?(neil.parkwaycc.co.uk)
Attachment #201159 - Flags: review?(neil.parkwaycc.co.uk) → review?(cbiesinger)
Version: unspecified → Trunk
Comment on attachment 201159 [details] [diff] [review] Patch rv1.0 hm... would it be possible to instead pass an nsIURI to initFileInfo and have the caller take care of the charset?
Comment on attachment 201159 [details] [diff] [review] Patch rv1.0 r- until I get a reply to comment 2
Attachment #201159 - Flags: review?(cbiesinger) → review-
Comment on attachment 201159 [details] [diff] [review] Patch rv1.0 Oops. Sorry for the delay. > would it be possible to instead pass an nsIURI to initFileInfo and have > the caller take care of the charset? I cannot understand well. The caller(internalSave) does not have document. Because when "Save Link Target As...", the document is not loaded because the user doesn't move to linked target. Therefore, we need current document charset by referrer.
Attachment #201159 - Flags: review- → review?(cbiesinger)
Ah, I understan what you said. Of course, it's possible. But current code make nsIURI in the initFileInfo. I obeied current code.
Comment on attachment 201159 [details] [diff] [review] Patch rv1.0 hrm, ok, but then why not just pass the charset to this function, instead of the entire referrer?
Isn't my patch more readable than sending charset directly? My params means, if document is not null(so, the URI is loaded), we should use the doc charset. otherwise(so, the URI is not loaded), if referrer is not null(so, it means previous document charset), we should use the charset. otherwise, we assume that the charset is UTF-8 from general rule.
Status: NEW → ASSIGNED
biesi: Please continue to review.
This bug is reproduced on Web Mail Service. This is serious i18n bug. Please hurry up to review.
Severity: minor → major
Priority: -- → P1
from mconnor, > ------- Comment #5 From Mike Connor 2005-12-16 11:35 PST [reply] ------- > > (From update of attachment 201154 [details] [diff] [review] [edit]) >>+ * @param aReferrer the referrer URI object (not URL string) to use, or null >>+ * if no referrer should be sent. > > this comment is bogus, since we're simply passing the referrer to extract the > charset, just use something like this: > > * @param aReferrer An nsIURI object for the referrer document, null if there is > no referrer I'll change this comment also in XPFE's patch.
as this function does not use the referrer, it would imo be better to always pass a charset to it and use that. the caller can decide whether to pass the referrer's origin charset or the document's charset. that way, the caller need not make up a referrer in case it doesn't have one.
Comment on attachment 201159 [details] [diff] [review] Patch rv1.0 so I'll mark this review-.
Attachment #201159 - Flags: superreview?(neil.parkwaycc.co.uk)
Attachment #201159 - Flags: review?(cbiesinger)
Attachment #201159 - Flags: review-
Attached patch Patch rv2.0 (obsolete) — Splinter Review
Attachment #201159 - Attachment is obsolete: true
Attachment #206229 - Flags: superreview?
Attachment #206229 - Flags: review?(cbiesinger)
Attachment #206229 - Flags: superreview? → superreview?(neil.parkwaycc.co.uk)
Comment on attachment 206229 [details] [diff] [review] Patch rv2.0 thanks, and sorry again about the delay
Attachment #206229 - Flags: review?(cbiesinger) → review+
Comment on attachment 206229 [details] [diff] [review] Patch rv2.0 > var sourceURL = getContentFrameURI(focusedWindow); >+ var sourceDocument = getContentFrameDocument(focusedWindow); > > try { >- return makeURI(sourceURL); >+ return makeURI(sourceURL, sourceDocument.characterSet); Nit: you could replace sourceURL with sourceDocument.location.href thus saving you the call to getContentFrameURI >+ var charset = aDocument ? aDocument.characterSet : null; >+ if (!aDocument && aReferrer) >+ charset = aReferrer.originCharset; This is clumsy... I'd use a double ?: or an if/else if/else to select between aDocument.characterSet and aReferrer.originCharset (or if you're feeling really leet, aDocument && aDocument.characterSet || aReferrer && aReferrer.originCharset).
Attachment #206229 - Flags: superreview?(neil.parkwaycc.co.uk) → superreview+
>>+ var charset = aDocument ? aDocument.characterSet : null; >>+ if (!aDocument && aReferrer) >>+ charset = aReferrer.originCharset; > This is clumsy... I'd use a double ?: or an if/else if/else to select between > aDocument.characterSet and aReferrer.originCharset (or if you're feeling really > leet, aDocument && aDocument.characterSet || aReferrer && > aReferrer.originCharset). Thanks, My current patch is correctly. We should use aReferrer only if aDocument is null. # Therefore, my first patch was wrong.
Attachment #206229 - Attachment is obsolete: true
Attachment #206517 - Flags: superreview+
Attachment #206517 - Flags: review+
Attachment #206517 - Flags: approval1.8.0.1?
checked-in.
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Attachment #206517 - Flags: approval1.8.1?
Can anyone identify whether this patch affects tbird at all? Tbird does use the xpfe contentAreaUtils, but I can't tell from basic examination whether these functions are being used.
Flags: blocking-seamonkey1.0?
Comment on attachment 206517 [details] [diff] [review] Patch for check-in a=dveditz for drivers
Attachment #206517 - Flags: approval1.8.1?
Attachment #206517 - Flags: approval1.8.1+
Attachment #206517 - Flags: approval1.8.0.1?
Attachment #206517 - Flags: approval1.8.0.1+
Thank you everyone!
Cancelling blocking-seamonkey1.0 request since this is already fixed.
Flags: blocking-seamonkey1.0?
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: