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

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 Jan 18, 2019
kilnerm added 3 commits Jan 21, 2019
@djones6 djones6 self-requested a review Jan 21, 2019
@kilnerm

This comment has been minimized.

Copy link
Contributor Author

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
Member

left a comment

👍 Looks good now, thanks.

@djones6 djones6 merged commit 120bcdc into master Jan 22, 2019
2 checks passed
2 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
license/cla Contributor License Agreement is signed.
Details
@djones6 djones6 deleted the sfs_failableinit branch Jan 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.