Directory Alias Given to Sandboxed App via Drag n' Drop Doesn't Grant App Permissions to Original Directory

Here's a situation:

I have an app that accepts folders to be dragged to it. You drag a folder in, and the folder gets moved to a directory in my app's sandbox. Now if a folder alias is dragged in instead of the original, my app does not get permission to the original directory contents after resolving the alias. If I try to access the contents of the folder after resolving the alias, I get nothing.


But if I drag in an alias of another type of file, let's say a .txt file, I can resolve the bookmark and access the contents.


So my question is this, is this intended or a bug? If the user gives me a folder alias via an open panel or drag and drop, shouldn't it be assumed that the user is granting me permission to the directory?

Replies

So my question is this, is this intended or a bug?

You should definitely file a bug about this.

I suspect that this is actually Just A Bug™ but, even if it is By Design™, it’s worth filing a bug explaining how that design is affecting your app in the real world.

Please post your bug number, just for the record.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Thanks for replying. I just filed a bug.


28258939

My bug got closed on this. I was told this is the intended behavior. Users who complained to me about this would seem to disagree. To them, they are expressing intent and they want my app to have access. Nothing I can do about it though.😢

The conclusion in the bug report was that dropping an alias gives the app access to the alias file but not to what it points to. If that's true, then your app must have had access to that text file already for some reason.


Where was the text file located and where was the alias located?


--gc

Yeah. I can't remember where the text file was since I filed this awhile ago. It's possible the original file was already in a directory my app had access to and I didn't realize it. I can't remember. But from my perspective at least, that wasn't an important part of my bug report.


I really wanted to know if the user explicitly hands me an alias folder (either from drag and drop or from an open panel) if that should give my app access to the original contents. I did get an answer, and I am grateful for that, even though it isn't the answer I was hoping to get.I get emails from users who drag alias folders to my app, and want my app to be able to open the original folder. Presumably, they have their reasons as to why they want to drag in an alias rather than the original folder itself. But it is what it is I guess.