Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GetParent for StorageFile doesn't work if the app doesn't have access to the parent folder #327

Closed
jaigak opened this issue Dec 4, 2020 · 9 comments
Assignees

Comments

@jaigak
Copy link
Contributor

jaigak commented Dec 4, 2020

No description provided.

@ghost ghost added the needs-triage label Dec 4, 2020
@maxkatz6
Copy link

maxkatz6 commented Dec 4, 2020

It makes sense for me. What is the expected result for you?

@jaigak
Copy link
Contributor Author

jaigak commented Dec 4, 2020

@maxkatz6 It should always return a StorageFolder even without access to the folder

@stevewri
Copy link
Contributor

stevewri commented Dec 7, 2020

@ptorr-msft - should we fold all the file system asks into one? See also #8, #127 and #140

@ptorr-msft
Copy link
Contributor

@Jaiganeshkumaran is your suggestion that instead of returning null, the API returns a StorageFolder with no visible properties, no visible items (except the one child you have access to?), and so on?

Can you explain the use-case for that?

@ptorr-msft
Copy link
Contributor

@stevewri I think #140 is better kept separate since it's more of a bug with existing behaviour, vs. a new feature request. #127 is about media transport controls; typo? :). #8 is the main thread but again I think it's best kept separate (if app has full access, this issue is moot; if the app doesn't have full access, this issue is still valid).

@benstevens48
Copy link

Personally I don't think this proposal is a good idea, because it would be a breaking change. At the moment my app code assumes that if I can get the StorageFolder object then I have access to the items in the folder (apart from some cases where some child items may have especially restricted permissions), and I can create items in the folder as long as it's not read-only. @Jaiganeshkumaran - what is the use case? Are you looking for an easy way to get the parent path?

@soumyamahunt
Copy link

@Jaiganeshkumaran @maxkatz6 @ptorr-msft the better solution would be to handle this similarly MacOS does: If the app already has access to parent folder then app GetParent will return the folder, if the app doesn't have access to the folder then Windows should prompt user asking if they want to permit the app to access the folder, if the user permits then the requested folder will be returned otherwise null will be returned.

@ptorr-msft @benstevens48 as for the use cases:

  1. An UWP markdown editor app that allows user to edit markdown file with live view, you might want to display images that user has included in subfolders and the only way to do that right now is using broadFileSystemAccess which seems rather overkill to me.
  2. Also an UWP IDE that requires access to all the files that are defined in it's project file and they can only be accessed if the app has access to parent folder. Also, this is the way xcode accesses files specified in .xcworkspace/.xcodeproj file in MacOS.

@benstevens48
Copy link

@soumyamahunt - of course I completely agree there needs to be a way to prompt access to the parent folder, or to ensure access to the parent folder to begin with via a more fine-grained permissions story (and I've commented on this before). My point was that StorageFile.GetParentAsync() should not return a StorageFolder object which has no permission to do anything, which is what the suggestion was. I think the API for prompting the user for access should be separate, because obviously there are situations in which you wouldn't want a prompt to appear or to be waiting for the results of a prompt.

@ptorr-msft
Copy link
Contributor

Agreed with @benstevens48 - the feature being asked for here is a separate feature ("Let me ask for permission to access other files in the folder without showing the picker"). GetParentAsync should not do that automatically. If you agree, please re-title the issue or close it and open a new one.

Thanks for the scenarios @soumyamahunt. We refer to these as "related files" or "linked files" and are looking at options for these kinds of scenarios, either enabling them automatically (maybe somewhat akin to the NeighboringFilesQuery concept; maybe with an additional prompt; etc.).

@jaigak jaigak closed this as completed Jan 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants