删除在 Mac 上下载的文件的执行权限
我们有一个在 Windows 服务器上运行的 Web 应用程序,它允许用户进行一些处理并下载结果。结果是在服务器上动态创建的一组文件并压缩成单个文件以方便下载过程。
在 Windows 上一切正常,但是当用户从 Mac 上的 Web 应用程序下载文件时,zip 文件的内容具有执行 (chmod +x) 权限集(我认为 *NIX 和 Linux 计算机上也会发生同样的情况) 。当然,可以通过运行“chmod -x”命令来删除,但是有没有一种方法可以删除文件的执行权限,以便在 Mac 上下载时,文件不具有默认执行权限设置?
We have a web app running on a Windows server, which allows a user to do some processing and download the results. The result is a set of files which are dynamically created on the server and zipped into a single file for facilitating the download process.
Everything works fine on Windows, but when users download the file from the web app on a Mac, the contents of the zip file have the execute (chmod +x) permission set (I presume that the same happens on *NIX and Linux machines). This can, of course, be removed by running the 'chmod -x' command, but is there a way by which one can remove the execute permission on the files, so that when downloaded on a Mac, the files don't have the execute permission set by default?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我相信这是不可能的 -
.zip
文件不包含权限,因此在 Mac 上它必须默认为“最许可”(否则 zip 内可能存在不包含权限的应用程序)在需要时被标记为可执行)。例如,
tar
确实会记录权限,但在 Windows 服务器上创建会有点困难。I believe it's not possible -
.zip
files don't contain permissions, so on a Mac it has to default to "most permissive" (otherwise it's possible that there are applications inside the zip that wouldn't be marked as executable when they need to be).tar
s, for instance, do record permissions, but that'd be a bit more difficult to create on a Windows server.