-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add custom character limit to pastes (#196)
# Background Recently I've been looking at alternatives to the service 0x0.st for pasting log files to. Logpaste seems like the perfect replacement, but it has limits on file size. Adding the ability for administrators to add custom file sizes would allow admins to make the file size the equivalent of 0x0's (512 MiB) or even larger. It would also allow them to set smaller limits as well if resources are limited or if the content being pasted doesn't warrant large sizes. # Changes - The default limit is now `2 * 1024 * 1024`, or 2 MiB instead of `2 * 1000 * 1000`, 2 MB - Add cli flag `-maxsize int` to allow admins to set an arbitrary limit on paste file sizes if they would like to - The argument is passed in by # of MiB (so for a 512MiB limit, `-maxsize 512`, or for the default 2MiB, `-maxsize 2`) - Add field `maxCharLimit` to the `defaultServer` struct for storing the given size - Add fields to `handlers/paste_test.go` to use the new struct field in order for tests to pass - Replace instances of `MaxPasteCharacters` with `s.maxCharLimit` --------- Co-authored-by: Michael Lynch <[email protected]>
- Loading branch information
Showing
5 changed files
with
27 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters