Light Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add no_listing option to disable directory indexing#845

Merged
mxpv merged 1 commit intomainfrom
robots
Mar 9, 2026
Merged

Add no_listing option to disable directory indexing#845
mxpv merged 1 commit intomainfrom
robots

Conversation

Copy link
Owner

mxpv commented Mar 9, 2026

Closes: #53

mxpv requested a review from Copilot March 9, 2026 03:25
Copilot started reviewing on behalf of mxpv March 9, 2026 03:26 View session
mxpv force-pushed the robots branch from 6cb2d4a to c3a38c1 Compare March 9, 2026 03:31
Copy link

codecov bot commented Mar 9, 2026

Welcome to Codecov

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered

mxpv merged commit 5eb0462 into main Mar 9, 2026
12 checks passed
Copilot AI reviewed Mar 9, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a no_listing configuration option to prevent directory indexing over HTTP, addressing issue #53 by making directory paths return 404 while still allowing direct file access.

Changes:

  • Added no_listing to server configuration and documented it in example config/docs.
  • Implemented directory-listing blocking in the local filesystem (pkg/fs.Local) by returning os.ErrNotExist for directories when enabled.
  • Updated and added tests to cover default vs enabled behavior and adjusted NewLocal call sites for the new parameter.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
services/web/server.go Adds NoListing to the server config struct for TOML/config plumbing.
services/web/server_test.go Adds HTTP-level tests validating directory listing vs 404 behavior using local storage.
pkg/fs/local.go Implements the actual "no directory listing" behavior in Local.Open.
pkg/fs/local_test.go Adds unit tests for Local.Open behavior with NoListing enabled/disabled.
cmd/podsync/main.go Wires cfg.Server.NoListing into fs.NewLocal(...).
services/migrate/migrate_test.go Updates fs.NewLocal(...) calls for the new function signature.
config.toml.example Documents no_index and no_listing in the example configuration.
CLAUDE.md Updates configuration documentation to include no_listing.

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +159 to +163
cfg := Config{
Port: 8080,
Path: "",
NoListing: true,
}
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

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

In this test, cfg.NoListing doesn't affect behavior because web.New never reads Config.NoListing (directory listing is controlled by the http.FileSystem implementation passed in). To avoid confusion, consider removing NoListing from cfg here and/or renaming the test to reflect that it's validating the storage-backed behavior rather than server config plumbing.

Copilot uses AI. Check for mistakes.
Copy link
Owner Author

mxpv Mar 9, 2026

Choose a reason for hiding this comment

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

@claude can you make a follow up PR to address this?

claude[bot] reacted with eyes emoji
Copy link
Contributor

claude bot Mar 9, 2026 *
edited
Loading

Choose a reason for hiding this comment

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

Claude finished @mxpv's task in 1m 45s ---- View job * claude/pr-845-20260309-0339 * Create PR


Follow-up: Fix misleading NoListing in server test

  • Gather context
  • Read the test file to understand current state
  • Fix the test (remove NoListing from cfg and add clarifying comment)
  • Run tests to verify
  • Commit and push changes
  • Create PR

Change made: Removed NoListing: true from the cfg struct in TestNoListingEnabledWhenConfigured (services/web/server_test.go:162) since web.New never reads Config.NoListing. Directory listing behavior is controlled by the http.FileSystem implementation (the Local storage passed in), not server config. Added a comment in the test to clarify this.

mxpv mentioned this pull request Mar 9, 2026
mxpv deleted the robots branch March 9, 2026 03:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot Copilot left review comments

claude[bot] claude[bot] left review comments

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Avoid folder indexing

2 participants