Xuanwo opened a new pull request, #8845: URL: https://github.com/apache/opendal/pull/8845
# Which issue does this PR close? N/A. # Rationale for this change `OperatorUri::new` stored `Url::username()` and `Url::password()` verbatim. `Url` reports userinfo as percent-encoded ASCII, while `root` and query options were already decoded, so the same reserved characters produced different results depending on which URI component carried them. For `smb://alice%40corp.com@host/share`, `OperatorUri::username()` returned `alice%40corp.com`, and `SmbConfig::from_uri` passed that literal encoded text to the SMB client as the user. # What changes are included in this PR? `OperatorUri::username()` and `OperatorUri::password()` decode userinfo with `percent_decode_str(..).decode_utf8_lossy()`, matching how `root` and query options are decoded. - A missing or empty username still yields `None`. - `Url` normalizes a URI with an empty password, such as `smb://alice:@host/share`, to `smb://alice@host/share`, so `password()` keeps returning `None` for that input. The URI parser cannot distinguish the two forms. - Unit tests in `core/core/src/types/operator/uri.rs` cover an encoded username and password, an password without a username, an empty password, and plain credentials. - The SMB URI documentation now states that user information is percent-decoded. # Are there any user-facing changes? URIs that percent-encode reserved characters in user information now resolve to the decoded username and password. `OperatorUri::username()` and `OperatorUri::password()` return decoded values, and services that read credentials from a URI, currently SMB, receive them. URIs without percent-encoded userinfo behave exactly as before. # Breaking changes # AI Usage Statement - Harness: pi coding agent - Model: DeepSeek - Effort: max - Role: Authored the implementation, unit tests, and documentation change under human direction. Tests cover URI parsing and the existing SMB config mapping; the credential path was not exercised against a live SMB server. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
