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

feat: Raise error if waved cannot find public/private dir #2130 #2378

Merged
merged 2 commits into from
Aug 5, 2024

Conversation

dbranley
Copy link
Contributor

@dbranley dbranley commented Aug 2, 2024

The PR fulfills these requirements: (check all the apply)

  • It's submitted to the main branch.
  • When resolving a specific issue, it's referenced in the PR's title (e.g. feat: Add a button #xxx, where "xxx" is the issue number).
  • When resolving a specific issue, the PR description includes Closes #xxx, where "xxx" is the issue number.
  • If changes were made to ui folder, unit tests (make test) still pass.
  • New/updated tests are included

Closes #2130

As requested in the ticket, I have made changes so that an error is thrown when an invalid public or private directory is provided when starting the wave server. The following validation was added to server.go in the splitDirMapping() function:

    if _, err := os.Stat(xs[1]); os.IsNotExist(err){
        panic(fmt.Sprintf("directory does not exist: %s", xs[1]))
    }

I tested the change by temporarily modifying the run target in the Makefile to have various combinations of valid and invalid values for public-dir and public-dir. Here are screen shots of a couple examples where invalid directories were given:

issue2130_badPublicDir1

issue2130_badPrivateDir1

And here are screen shots where valid directories are provided and I also included the browser in the screen shots to show that the server came up fine and the custom directory is accessible:

issue2130_validDirs1

issue2130_validDirs2

A couple things to note:

  1. I assume testing this by running make run rather than using the waved command is sufficient. I normally run everything in my dev environment with make, but if you would rather I test using the waved command then let me know.
  2. I did not test this on Windows, since I run on macos. I'm confident this should work fine on Windows, but wanted to make sure you were aware that I don't have a Windows machine to test this on.

Let me know if you have any questions or would like me to make any changes. Thanks!

Copy link
Collaborator

@mturoci mturoci left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks @dbranley!

@mturoci mturoci merged commit dd512ac into h2oai:main Aug 5, 2024
@dbranley dbranley deleted the feat/issue-2130 branch September 24, 2024 18:10
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.

Raise error if waved cannot find public/private dir
2 participants