-
Notifications
You must be signed in to change notification settings - Fork 759
Add comprehensive special character handling with validation refactoring and extensive test coverage #1078
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
Conversation
…aths Co-authored-by: houseme <[email protected]>
Co-authored-by: houseme <[email protected]>
Co-authored-by: houseme <[email protected]>
Co-authored-by: houseme <[email protected]>
Co-authored-by: houseme <[email protected]>
Co-authored-by: houseme <[email protected]>
|
@copilot Please deeply analyze and analyze the logical processing of the current business scenario, further improve and optimize it, add enough test cases, and format the code 'Cargo fmt --all' before submitting the code, and process the special character content in the path when uploading. Do you need to process special characters synchronously when obtaining objects? |
- Added 7 new test cases for special characters: * HEAD object with special characters * COPY object with special characters (source & dest) * Unicode characters in paths * Special chars in different path positions * Control character rejection validation * LIST with special character prefixes * Delimiter-based listing with special chars - Refactored validation into reusable helper function: * Created validate_object_key() to centralize logic * Applied validation to PUT, GET, HEAD, COPY, DELETE operations * Consistent error messages and logging across all operations - Code formatted with cargo fmt --all Total test coverage: 12 comprehensive test functions covering all edge cases Co-authored-by: houseme <[email protected]>
Completed deep analysis and optimization as requested. Here's what was implemented: Logical Processing Analysis: Improvements Made (commit a24a6fa):
Special Character Handling:
The validation is symmetric - we validate control characters (null bytes, newlines, carriage returns) on both upload and retrieval, and log debug info for troubleshooting. No manual URL encoding/decoding is needed as s3s handles this correctly. Test coverage increased to 800+ lines with 12 comprehensive test functions covering all edge cases. |
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.OpenSSF Scorecard
Scanned Files
|
|
@copilot Please deeply analyze and analyze the error messages in the current action, or execute Please process as a senior rust architect. Now please start exporting your processing and all descriptions in English. |
- Removed unnecessary .await on stop_server() calls (returns unit type) - Fixed iterator references: use &test_cases instead of consuming test_cases - Dereferenced key and content when iterating (&test_cases yields &&str) - Removed unused imports: TEST_BUCKET, Duration, timeout, debug - Re-added debug macro import (actually used in tests) All clippy checks now pass with -D warnings flag. Verified with: cargo clippy --all-targets --all-features -- -D warnings Co-authored-by: houseme <[email protected]>
Fixed all clippy errors and warnings (commit 807641d). Issues Found and Fixed:
Verification Completed: All 12 test functions now compile cleanly with zero clippy warnings. |
Type of Change
Related Issues
Special characters in path issue (spaces, plus signs causing UI navigation failures and 400 errors)
Summary of Changes
Investigation revealed the backend correctly handles special characters via the s3s library's URL decoding (verified in source at
s3s-0.12.0-rc.4/src/ops/mod.rs:261). Issues stem from UI/client-layer encoding problems. CLI tools (mc, aws-cli) work correctly, confirming backend integrity.Backend enhancements (
rustfs/src/storage/ecfs.rs):validate_object_key()helper function to eliminate code duplication and ensure consistencyComprehensive test coverage (
crates/e2e_test/src/special_chars_test.rs- 800+ lines, 12 test functions):"a f+/b/c/3/README.md""ES+net/LHC+Data+Challenge/file.json"Documentation (47KB total):
Key findings:
%20, plus→%2B(not+which represents literal plus in URL paths)Checklist
make pre-commit(cargo fmt, cargo clippy, cargo check all successful)Impact
Additional Notes
Code Quality Improvements:
cargo fmt --allcargo clippy --all-targets --all-features -- -D warningspasses with zero warningsTest Suite Fixes:
.awaitonstop_server()calls (returns unit type, not a Future)&test_casesto avoid moving*keyand*contentin loopsTEST_BUCKET,Duration,timeoutSpecial Character Processing:
Special character handling is symmetric between upload and retrieval operations:
validate_object_key()function provides consistent validation across all operationsTest Coverage:
Comprehensive test suite (800+ lines, 12 test functions) covers:
Verification:
cargo fmt --all --check- All code properly formattedcargo clippy --all-targets --all-features -- -D warnings- Zero warningscargo check --all-targets- Compilation successfulDocumentation provides comprehensive guidance for users experiencing issues and explains why CLI tools work while some custom clients/UIs may not.
Thank you for your contribution! Please ensure your PR follows the community standards (CODE_OF_CONDUCT.md) and sign the CLA if this is your first contribution.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.