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

"File chmod" is not working correctly. #507

Closed
wiinxt opened this issue Apr 27, 2024 · 1 comment
Closed

"File chmod" is not working correctly. #507

wiinxt opened this issue Apr 27, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@wiinxt
Copy link

wiinxt commented Apr 27, 2024

Describe the bug
The "File chmod" option is not working because fs.chmodSync mode parameter needs an octal and not a decimal. The default value 775 in decimal gives 1407 in octal, so chmod sets -r-----rwt instead of -rwxrwxr-x.

The error is here:

fs.chmodSync(fullpath, Config.getInstance().cfg("file_chmod"));

Node.js doc of fs.chmod: https://nodejs.org/api/fs.html#fschmodpath-mode-callback

I suggest this change to fix the error (convert the number to a string, then parse it as octal) :

fs.chmodSync(fullpath, parseInt(Config.getInstance().cfg("file_chmod").toString(), 8)); 

To Reproduce

  1. Go to Advanced options
  2. Click on Set file permissions
  3. The permissions on files are not 775 (-r-----rwt instead of -rwxrwxr-x)

Expected behavior
The permission must be 775 (-rwxrwxr-x)

Server:

  • Docker

Workaround
I set 509 (which is 775 in octal) for now, it works well.

@wiinxt wiinxt added the bug Something isn't working label Apr 27, 2024
@MrBrax
Copy link
Owner

MrBrax commented Apr 27, 2024

good catch, probably an oversight that carried over from the php version

@MrBrax MrBrax closed this as completed in 4aa04da Jun 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants