Open brucealthompson opened 1 month ago
Here's the fix:
**newURL := dir.Scheme() + "://" + filepath.ToSlash(buildDir)
newDir, err := storage.ParseURI(newURL)
if err != nil {
return err
}**
isDir, err := storage.CanList(newDir)
if err != nil {
return err
}
Pull request created: https://github.com/fyne-io/fyne/pull/5215
As noted on the PR I don't think that is a fix - it looks like a workaround for your repository. In a situation where the URI represents something other than another file system (like a media library or an LDAP directory) this will still create very strange results and/or not work at all.
Checklist
Describe the bug
There is "file" respository specific code in fyne.io\fyne\v2@v2.5.2\dialog\file.go: func (f *fileDialog) setLocation(dir fyne.URI) error {}
Here is the code where the issue is: newDir := storage.NewFileURI(buildDir) isDir, err := storage.CanList(newDir) if err != nil { return err }
Notice that setLocation takes a fyne URL as input (dir fyne.URI). If the fyne URL has a scheme of "file" then the call to storage.NewFileURI(buildDir) above will work. If the fyne URL in the parameter (dir fyne.URI) has a scheme different than "file". Then the call to storage.NewFileURI(buildDir) will return a URL with the "file" scheme instead of the scheme passed in dir fyne.URI.
I found this bug when trying to use the respository "httpfile" that I created.
How to reproduce
Create a non "file" repository. Create a new file dialog pointing to the non "file" repository Try traversing directories in the non "file" repository. The UI will stop once storage.NewFileURI(buildDir) resturns an invalid "file" URI.
Screenshots
No response
Example code
Create a new file dialog using the following code:
Fyne version
2.5.2
Go compiler version
1.23.1
Operating system and version
Windows 11
Additional Information
No response