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

fflogs: user_auth: Fix key path creation #6

Merged
merged 1 commit into from
Nov 12, 2024

Conversation

vsafili
Copy link
Contributor

@vsafili vsafili commented Nov 11, 2024

If the directory where the keys are to be stored doesn't exist, all the directories leading to that path need to be created. The check if the path exists checks the existence correctly, but the filename itself was also created as a directory leading to user mode being unusable with the following error:

File "fflogsapi/user_auth.py", line 105, in _generate_ss_x509_cert
with open(self.KEY_PATH, 'wb') as f:
^^^^^^^^^^^^^^^^^^^^^^^^^
IsADirectoryError: [Errno 21] Is a directory: './fflogsapi/fflogs_auth_redirect_key.pem'

Fix this by running os.makedirs() on the dirname, and not the full path.

While at it, fix the message telling the user to press "any key", as "any key" does not complete the input() call.

If the directory where the keys are to be stored doesn't exist, all the
directories leading to that path need to be created. The check if the
path exists checks the existence correctly, but the filename itself was
also created as a directory leading to user mode being unusable with the
following error:

  File "fflogsapi/user_auth.py", line 105, in _generate_ss_x509_cert
    with open(self.KEY_PATH, 'wb') as f:
         ^^^^^^^^^^^^^^^^^^^^^^^^^
IsADirectoryError: [Errno 21] Is a directory: './fflogsapi/fflogs_auth_redirect_key.pem'

Fix this by running os.makedirs() on the dirname, and not the full path.

While at it, fix the message telling the user to press "any key", as
"any key" does not complete the input() call.

Signed-off-by: Vaal Safili <[email protected]>
Copy link
Owner

@halworsen halworsen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch, thanks. I'll stage a patch version and publish it 😃

@halworsen halworsen merged commit 2fbef62 into halworsen:master Nov 12, 2024
1 check passed
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

Successfully merging this pull request may close these issues.

2 participants