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

[Bug]: shell.trashItem() doesn't move file to trash when file is in OneDrive, instead it is moved to root of OneDrive #38541

Closed
3 tasks done
Shurikal opened this issue Jun 1, 2023 · 2 comments
Labels
25-x-y bug 🪲 has-repro-repo Issue can be reproduced by cloning a git repo

Comments

@Shurikal
Copy link

Shurikal commented Jun 1, 2023

Preflight Checklist

Electron Version

25.0.1

What operating system are you using?

macOS

Operating System Version

macOS Ventura 13.3.1 (a)

What arch are you using?

arm64 (including Apple Silicon)

Last Known Working Electron version

No response

Expected Behavior

shell.trashItem should move Item to trash

Actual Behavior

shell.trashItem moves Item to root of OneDrive folder

Testcase Gist URL

No response

Additional Information

I tried to create the Electron Fiddle app, but it creates the file in the wrong place. I have an example app which shows the problem when it is run from inside a folder in the OneDrive.

@Shurikal
Copy link
Author

Shurikal commented Jun 2, 2023

After playing a bit around with objective-c (never done that before), I think I know where the problem is:

BOOL did_trash = [[NSFileManager defaultManager] trashItemAtURL:url

I observed the following behaviour with a small test script:

// File goes into root directory of onedrive
BOOL did_trash = [[NSFileManager defaultManager] trashItemAtURL:self.fileURL
                                                   resultingItemURL:nil
                                                             error:&deleteError];

// File is gone forever, doesn't go into trash
BOOL did_trash = [self.fileManager removeItemAtURL:self.fileURL error:&deleteError];

In both cases did_trash returns true.

Maybe someone has an idea how to solve this issue :)

@jkleinsc jkleinsc added has-repro-repo Issue can be reproduced by cloning a git repo 25-x-y labels Jun 5, 2023
@MarshallOfSound
Copy link
Member

This is a bug in OneDrive implementation, the API Electron is calling is correct but OneDrive clearly isn't handling it correctly 😅 I'd suggest reporting this bug to OneDrive / msft support as it's something that their app can fix but Electron can / should not.

@MarshallOfSound MarshallOfSound closed this as not planned Won't fix, can't repro, duplicate, stale Jun 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
25-x-y bug 🪲 has-repro-repo Issue can be reproduced by cloning a git repo
Projects
No open projects
Status: Unsorted Items
Development

No branches or pull requests

3 participants