Skip to content

Download task file system permissions #2527

@berkcebi

Description

@berkcebi

Hey hey! 👋

Alamofire is using URLSessionDownloadTask for download tasks and the file created under the temporary directory by URLSessionDownloadTask has file system permissions set to -rw-------. (To be honest, I'm not sure why that is.) Alamofire then moves this file to the location provided by the user, keeping the permissions intact.

These default permissions are unlike most use cases, where they're set to -rw-r--r--:

  • Downloading the file through the browser
  • Downloading the file using a tool like wget, curl
  • Downloading the file using AFNetworking
  • Using Alamofire, requesting the file as a data object then writing to file

Either by default or when an option is provided, Alamofire could set the permissions up after moving the file from the temporary directory. I wanted to reach out and gather some feedback on this.


What did you do?

Used DownloadTask to download a file to a url, on macOS.

What did you expect to happen?

The downloaded file to have the same file system permissions (by default), as downloading the same file through a browser, using a tool like wget or another networking library like AFNetworking: -rw-r--r--.

What happened instead?

The downloaded file has a file system permission of -rw-------, not letting other users to access the file.

Alamofire Environment

Alamofire version: 4.7.2
Xcode version: 9.3.1
Swift version: 4.1
Platform(s) running Alamofire: macOS
macOS version running Xcode: 10.13.4 (17E202)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions