electron icon indicating copy to clipboard operation
electron copied to clipboard

[Bug]: MAS builds do not allow overwriting of downloaded file to non-excepted directories

Open devinbinnie opened this issue 2 years ago • 0 comments

Preflight Checklist

Electron Version

19.0.6

What operating system are you using?

macOS

Operating System Version

macOS Monterey 12.4

What arch are you using?

arm64 (including Apple Silicon)

Last Known Working Electron version

Unknown, reproduces since at least v18 Reproduced on v18, v19 and v20.

Expected Behavior

  1. Click on a link that will fire the will-download event.
  2. You should see a dialog pop up as to where to save the file. Select a file that already exists.
  3. The user is prompted to replace the file. Select Replace.
  4. The file is successfully replaced on the drive.

Actual Behavior

Instead of the file being replaced, the download state changed to interrupted after the file transfer is complete. The file is not replaced and remains in its original state.

Testcase Gist URL

No response

Additional Information

This only reproduces on MAS builds. I've been generating them using electron-builder. I can try and come up with a Gist if that would be helpful.

I added the required entitlement com.apple.security.files.user-selected.read-write which allows me to read and write files, but apparently replacing them does not work. HOWEVER, if you add the specific entitlements for special folders in the users (eg. com.apple.security.files.downloads.read-write) it will allow you to replace files in the specified folder and will not cause the download to be interrupted.

I'm guessing something's a little wonky with the permissions for replacing files with the user-selected entitlement.

devinbinnie avatar Jul 27 '22 19:07 devinbinnie