-
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #335 from Narayanbhat166/support_max_upload_file_s…
…ize_config * feat: add a check in the store file function to check whether the upload dir is full * chore: cargo clippy * feat: add test cases * refactor: rename config variable * Revert "refactor: rename config variable" This reverts commit 2328473. * test(fixtures): update fixture for max upload size * refactor(server): vendor get_size function from fx_extra * refactor(paste): update error message * fix(lints): apply clippy suggestions --------- Co-authored-by: Orhun Parmaksız <[email protected]>
- Loading branch information
Showing
6 changed files
with
75 additions
and
2 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[server] | ||
address = "127.0.0.1:8000" | ||
max_content_length = "10KB" | ||
max_upload_dir_size = "20KB" | ||
upload_path = "./upload" | ||
|
||
[paste] | ||
default_extension = "txt" | ||
duplicate_files = true |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env bash | ||
|
||
setup() { | ||
truncate -s 9KB bigfile1 bigfile2 bigfile3 | ||
} | ||
|
||
run_test() { | ||
result=$(curl -s -F "file=@bigfile1" localhost:8000) | ||
result=$(curl -s -F "file=@bigfile2" localhost:8000) | ||
curl -s "$result" | ||
|
||
result=$(curl -s -F "file=@bigfile3" localhost:8000) | ||
test "upload directory size limit exceeded" = "$result" | ||
} | ||
|
||
teardown() { | ||
rm bigfile* | ||
rm -r upload | ||
} |
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