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

fileserver: Add file_limit option for browse #6648

Merged
merged 4 commits into from
Nov 5, 2024

Conversation

atakanyenel
Copy link
Contributor

This PR fixes the issue #6644 . I'm not sure about the config name file_limit, I prefer max_dir_limit etc.The default is still 10000.

As mentioned in the issue, this PR gave me some background on file serve, so I will try to look at paging as well. Please feel free to edit any documentation as you see fit.

@CLAassistant
Copy link

CLAassistant commented Oct 20, 2024

CLA assistant check
All committers have signed the CLA.

@atakanyenel atakanyenel force-pushed the master branch 2 times, most recently from d95c79e to 1327fc6 Compare October 20, 2024 21:30
modules/caddyhttp/fileserver/browse.go Outdated Show resolved Hide resolved
modules/caddyhttp/fileserver/browse.go Outdated Show resolved Hide resolved
modules/caddyhttp/fileserver/caddyfile.go Outdated Show resolved Hide resolved
@francislavoie francislavoie changed the title Add file_limit option for file_server browse fileserver: Add file_limit option for browse Oct 20, 2024
@francislavoie francislavoie added the feature ⚙️ New feature or request label Oct 20, 2024
@atakanyenel atakanyenel force-pushed the master branch 2 times, most recently from 48c5441 to 5a5452d Compare October 21, 2024 15:23
@francislavoie francislavoie requested a review from mholt October 21, 2024 15:23
@atakanyenel atakanyenel force-pushed the master branch 3 times, most recently from 6d3dd2d to 05261ec Compare October 21, 2024 15:34
Copy link
Member

@francislavoie francislavoie left a comment

Choose a reason for hiding this comment

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

Thanks!

For bonus points, it could probably use an adapt test (can just add it to an existing file_server test) to make sure it produces the correct JSON.

@mholt
Copy link
Member

mholt commented Oct 22, 2024

Thanks! This LGTM, but before I merge I have just one stupid nit: should it be called DirEntryLimit? It's a little more specific (could FileLimit be limiting file sizes? Something else?).

Similarly, defaultMaxDirLimit could be renamed defaultDirEntryLimit.

@atakanyenel
Copy link
Contributor Author

I added the test and updated the constant name. I'm keeping the config name still as "file_limit". I can also change that if required.

@atakanyenel
Copy link
Contributor Author

@mholt I don't want to pressure at all, but the CL still is approved but only needs your review to merge. It's the youngest review in the already approved CLs, so could you take a look, when you have time ?

Then I can work on other issues too :)

@mholt mholt added this to the v2.9.0-beta.3 milestone Nov 4, 2024
@@ -66,8 +66,15 @@ type Browse struct {
// - `sort size` will sort by size in ascending order
// The first option must be `sort_by` and the second option must be `order` (if exists).
SortOptions []string `json:"sort,omitempty"`

// FileLimit limits the number of up to n DirEntry values in directory order.
Copy link
Member

Choose a reason for hiding this comment

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

Should we document that -1 means no limit? (And 0 is default limit, which is currently 10,000)

Copy link
Member

@mholt mholt left a comment

Choose a reason for hiding this comment

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

I'm going to merge this, but I still think we should enhance the comment/docs before the final release; and maybe even mark this option as experimental since we don't quite understand its characteristics in the wild yet. Would you be able to help with that? I just don't have a chance right now. Thanks!

@mholt mholt merged commit cc23ad6 into caddyserver:master Nov 5, 2024
33 checks passed
@mholt mholt linked an issue Nov 5, 2024 that may be closed by this pull request
@atakanyenel
Copy link
Contributor Author

I'm going to merge this, but I still think we should enhance the comment/docs before the final release; and maybe even mark this option as experimental since we don't quite understand its characteristics in the wild yet. Would you be able to help with that? I just don't have a chance right now. Thanks!

Yes, I can do this. I will send another PR soon. Thanks for the merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature ⚙️ New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Increasing the limit for file_server
4 participants