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

List Config dir if directory is specified #468

Merged
merged 3 commits into from
Mar 19, 2024
Merged

Conversation

MrStashley
Copy link

@MrStashley MrStashley commented Mar 15, 2024

I created a conditional http handler that serves the file if it is a file, and lists the directory as json if it is a directory

});
}

testConfigListDir() {
Copy link
Author

Choose a reason for hiding this comment

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

This is test code and should be removed, but I figured it might help a reviewer to see how I tested this code

wavesrv/cmd/main-server.go Fixed Show resolved Hide resolved
wavesrv/cmd/main-server.go Dismissed Show dismissed Hide dismissed
fstat, err := os.Stat(configFullPath)
if errors.Is(err, fs.ErrNotExist) {
w.WriteHeader(404)
w.Write([]byte(fmt.Sprintf("file not found: ", configAbsPath)))

Check warning

Code scanning / CodeQL

Reflected cross-site scripting Medium

Cross-site scripting vulnerability due to
user-provided value
.
@sawka sawka merged commit 0a14a58 into main Mar 19, 2024
5 checks passed
@sawka sawka deleted the cole/config-directory-listing branch March 19, 2024 00:11
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.

3 participants