[Mono-bugs] [Bug 370385] New: SaveFileDialog selects directory as filename without intent

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Mar 13 10:44:25 EDT 2008


https://bugzilla.novell.com/show_bug.cgi?id=370385


           Summary: SaveFileDialog selects directory as filename without
                    intent
           Product: Mono: Class Libraries
           Version: 1.2.6
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Windows.Forms
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: andyhume32 at yahoo.co.uk
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


Created an attachment (id=201258)
 --> (https://bugzilla.novell.com/attachment.cgi?id=201258)
possible patch

When using SaveFileDialog, before entering the intended file path and hitting
OK, the dialog suddenly completes simply when changing directory.  One is just
clicking away to get to the necessary directory and boom the dialog has ok'd
itself, the result save file path is thus /aa/bb/cc where cc is a directory --
the last one clicked. :-(

Occurs on Linux and Windows, and in all tested Mono versions.

Debugging showed that this effect occurs for directories that have another
"Attribute" set, for instance 'read-only'.  Repro is thus:
* Linux
mkdir foobar_readonly
chmod 444 foobar_readonly
Run repro app and attempt to return a save file path of
".../foobar_readonly/file.txt".  On attempting to open the directory the dialog
will exit.
* Windows
Same, but set read-only with "attrib +r foobar_readonly".


This occurs because clicking on a file item its name is copied to the filename
textbox.  But the check for a directory needs to be:
  if ((fsEntry.Attributes & FileAttributes.Directory) ==
FileAttributes.Directory) {
rather than:
  if (fsEntry.Attributes == FileAttributes.Directory) {

Directory which have read-only set by default in Windows include "My
Documents", thus likely that a user will hit this.

Patch attached, which repeats that change for all such == and !=.


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list