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

Log error in StaticFIleServer init if passed a non-directory path #1389

Merged
merged 11 commits into from Jan 22, 2019

Conversation

kilnerm
Copy link
Contributor

@kilnerm kilnerm commented Jan 18, 2019

Description

This PR updates the StaticFileServer to have a failable initializer, updates the initializer to fail if the path parameter is not to a directory and adds a test to ensure the initializer fails when path is a file.

Motivation and Context

Currently the StaticFileServer documentation states the path parameter should be a folder but the initializer will accept a file which can lead to files being incorrectly served. This change prevents this scenario.

How Has This Been Tested?

I have added a test which will try to create a StaticFileServer using a path to a file, should the StaticFileServer be successfully created then the test will fail. I have also stepped through the debugger to ensure the code functions as expected.

Checklist:

  • Make StaticFileServer initializer failable
  • Add failing tests
  • Update StaticFileServer initializer to fail.

@kilnerm kilnerm added this to the 2019.02 milestone Jan 18, 2019
@kilnerm kilnerm self-assigned this Jan 18, 2019
@kilnerm kilnerm force-pushed the sfs_failableinit branch 2 times, most recently from edb4d9a to 793eda9 Compare January 21, 2019 08:56
@djones6 djones6 self-requested a review January 21, 2019 10:46
@kilnerm
Copy link
Contributor Author

kilnerm commented Jan 21, 2019

I have updated the change to be non-breaking.

@kilnerm kilnerm changed the title Fail StaticFIleServer init if passed a non-directory path Log error in StaticFIleServer init if passed a non-directory path Jan 21, 2019
Copy link
Collaborator

@djones6 djones6 left a comment

Choose a reason for hiding this comment

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

👍 Looks good now, thanks.

@djones6 djones6 merged commit 120bcdc into master Jan 22, 2019
@djones6 djones6 deleted the sfs_failableinit branch January 22, 2019 14:03
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.

None yet

2 participants