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

SaveFile method creates unreadable file #1

Closed
BrianHoldsworth opened this issue Mar 4, 2018 · 4 comments
Closed

SaveFile method creates unreadable file #1

BrianHoldsworth opened this issue Mar 4, 2018 · 4 comments

Comments

@BrianHoldsworth
Copy link
Contributor

In SaveFile, ioutil.WriteFile is used to save the file without any file attributes. Therefore, the file cannot be read until one performs a chmod to set reasonable attributes.

var err = ioutil.WriteFile(filename, pdf.Bytes(), 0)

should be

var err = ioutil.WriteFile(filename, pdf.Bytes(), 0644)

@balacode
Copy link
Owner

balacode commented Mar 4, 2018

Thank you very much Brian! It is fixed. Apparently, this flag doesn't do much on Windows? (I tested only on Windows so far) Can you please tell me the OS you used. Linux?

@BrianHoldsworth
Copy link
Contributor Author

Actually I am using macOS High Sierra. I suspect the same behavior would have occurred on Linux, though.

@balacode
Copy link
Owner

balacode commented Mar 4, 2018

I suppose so too. I'll test it on Linux, try to reproduce that behaviour and close the issue later. But it's already fixed in code. Thanks again.

@balacode
Copy link
Owner

balacode commented Mar 4, 2018

I tested the file attributes on Debian GNU/Linux 9 (stretch) and the issue you reported occurs there too when 'perm' is set to 0 (except on an NTFS mounted volume). Thank you.

@balacode balacode closed this as completed Mar 4, 2018
balacode pushed a commit that referenced this issue Mar 13, 2018
Merge pull request #6 from BrianHoldsworth/master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants