Closed Bug 246280 Opened 20 years ago Closed 20 years ago

Empty Open with default application should not be available

Categories

(Core Graveyard :: File Handling, defect)

x86
Windows XP
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla1.7final

People

(Reporter: timeless, Assigned: Biesinger)

References

()

Details

(Keywords: fixed-aviary1.0, fixed1.7.5)

Attachments

(1 file, 3 obsolete files)

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8a2) Gecko/20040609

Steps.
1. click url link
2. look at dialog

Expected results:
no option to open with default application
(i guess)

Actual results:
option to open with default application
Attached patch patch (obsolete) — Splinter Review
something like this, maybe...
Attached patch patch v2 (obsolete) — Splinter Review
this is slightly better
Attachment #151303 - Attachment is obsolete: true
Comment on attachment 151304 [details] [diff] [review]
patch v2

should we maybe try to get this on the 1.7 branch?
Attachment #151304 - Flags: review?(darin) → review+
Comment on attachment 151304 [details] [diff] [review]
patch v2

yes, I think this should go onto the 1.7 branch. I'll request approval once I
have sr.
Attachment #151304 - Flags: superreview?(bryner)
(this bug may also fix bug 246267, by making sure that the temp file name does
not end in a dot)
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla1.7final
Attachment #151304 - Flags: superreview?(bryner) → superreview?(jst)
Comment on attachment 151304 [details] [diff] [review]
patch v2

       url->GetFileExtension(aExtension);
+      // Windows ignores terminating dots. So we have to as well, so
+      // that our security checks do "the right thing"
+      // In case the extension consisted only of the dot, the code below will
+      // extract an extension from the filename
+      if (!aExtension.IsEmpty() && aExtension.Last() == '.')
+	 aExtension.Truncate(aExtension.Length() - 1);
+    }

Seems to me like windows ignores any number of terminating '.'s, so this code
should do the same, no? Same thing in the last chunk of this diff.

sr=jst with that fixed.
Attachment #151304 - Flags: superreview?(jst) → superreview+
Attached patch patch v3 (obsolete) — Splinter Review
good point. fortunately, nsCString has this friendly Trim method, which this
patch uses :)
(with the parameter set to only trim at the end)
Attachment #151304 - Attachment is obsolete: true
Attached patch patch v4Splinter Review
let's try using the right variable
Attachment #152462 - Attachment is obsolete: true
v4 checked in
Checking in nsExternalHelperAppService.cpp;
/cvsroot/mozilla/uriloader/exthandler/nsExternalHelperAppService.cpp,v  <-- 
nsExternalHelperAppService.cpp
new revision: 1.264; previous revision: 1.263
done
Comment on attachment 152464 [details] [diff] [review]
patch v4

This patch trims trailing dots before extension checking; thus treating .exe.
files the same as .exe files: Disallow "open with application" in the helper
app dialog, and makes "launch file" from the progress dialog/download manager
show a warning.


(previous versions of this patch have the r and sr marked)
Attachment #152464 - Flags: approval1.7.1?
fixed on trunk
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
*** Bug 246184 has been marked as a duplicate of this bug. ***
Flags: blocking-aviary1.0?
Comment on attachment 152464 [details] [diff] [review]
patch v4

a=asa for checkin to aviary and 1.7.x branch.
Attachment #152464 - Flags: approval1.8a4+
Attachment #152464 - Flags: approval1.7.x?
Attachment #152464 - Flags: approval1.7.x+
(I'm assuming the comment is correct, rather than patch flags)

fixed on 1.7 and aviary branch.
Flags: blocking-aviary1.0?
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: