You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by "emliunix (via GitHub)" <gi...@apache.org> on 2026/03/20 15:37:35 UTC

[PR] fix(services/onedrive): fix url of onedrive_create_upload_session [opendal]

emliunix opened a new pull request, #7257:
URL: https://github.com/apache/opendal/pull/7257

   # Which issue does this PR close?
   
   Closes #7256
   
   # Rationale for this change
   
   To fix the bug
   
   # What changes are included in this PR?
   
   change upload session url to include filename
   
   # Are there any user-facing changes?
   
   no
   
   # AI Usage Statement
   
   by hand
   
   # NOTE
   
   Need to test


-- 
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: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(services/onedrive): fix url of onedrive_create_upload_session [opendal]

Posted by "emliunix (via GitHub)" <gi...@apache.org>.
emliunix commented on code in PR #7257:
URL: https://github.com/apache/opendal/pull/7257#discussion_r3427153930


##########
core/services/onedrive/src/core.rs:
##########
@@ -750,3 +758,62 @@ impl OneDriveSigner {
         Ok(())
     }
 }
+
+#[cfg(test)]
+mod tests {
+    use serde::Deserialize;
+
+    use crate::ONEDRIVE_SCHEME;
+
+    use super::*;
+
+    fn get_request_json_body<T: for<'a> Deserialize<'a>>(request: Request<Buffer>) -> T {

Review Comment:
   it's in test only, and on the contrary, to change it to DeserializeOwned is a production code change which has larger change surface.



-- 
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: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(services/onedrive): fix url of onedrive_create_upload_session [opendal]

Posted by "erickguan (via GitHub)" <gi...@apache.org>.
erickguan commented on code in PR #7257:
URL: https://github.com/apache/opendal/pull/7257#discussion_r3458716891


##########
core/services/onedrive/src/graph_model.rs:
##########
@@ -131,10 +131,10 @@ impl CreateDirPayload {
 struct EmptyStruct {}
 
 #[derive(Debug, Clone, Serialize, Deserialize)]
-struct FileUploadItem {
+pub struct FileUploadItem {
     #[serde(rename = "@microsoft.graph.conflictBehavior")]
-    conflict_behavior: String,
-    name: String,
+    pub conflict_behavior: String,
+    pub name: String,

Review Comment:
   Prefer serde API or use pub(crate). It's fine to add pub(crate) to structs or fields in this file.



-- 
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: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(services/onedrive): fix url of onedrive_create_upload_session [opendal]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #7257:
URL: https://github.com/apache/opendal/pull/7257#discussion_r2968145661


##########
core/services/onedrive/src/core.rs:
##########
@@ -382,11 +382,10 @@ impl OneDriveCore {
         path: &str,
         args: &OpWrite,
     ) -> Result<Response<Buffer>> {
-        let parent_path = get_parent(path);
         let file_name = get_basename(path);
         let url = format!(
             "{}:/createUploadSession",
-            self.onedrive_item_url(parent_path, true),
+            self.onedrive_item_url(path, true),
         );

Review Comment:
   Consider adding a regression unit test for `onedrive_create_upload_session` URL construction to ensure the generated endpoint includes the full file path (including filename) and stays consistent with the `item.name` sent in the request body. This would prevent reintroducing the previous 400 "Name from path does not match name from body" behavior when refactoring URL helpers.



-- 
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: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(services/onedrive): fix url of onedrive_create_upload_session [opendal]

Posted by "emliunix (via GitHub)" <gi...@apache.org>.
emliunix commented on code in PR #7257:
URL: https://github.com/apache/opendal/pull/7257#discussion_r3386125982


##########
core/services/onedrive/src/core.rs:
##########
@@ -382,11 +382,10 @@ impl OneDriveCore {
         path: &str,
         args: &OpWrite,
     ) -> Result<Response<Buffer>> {
-        let parent_path = get_parent(path);
         let file_name = get_basename(path);
         let url = format!(
             "{}:/createUploadSession",
-            self.onedrive_item_url(parent_path, true),
+            self.onedrive_item_url(path, true),
         );

Review Comment:
   suggest a UT file and examples for reference



-- 
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: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(services/onedrive): fix url of onedrive_create_upload_session [opendal]

Posted by "erickguan (via GitHub)" <gi...@apache.org>.
erickguan commented on PR #7257:
URL: https://github.com/apache/opendal/pull/7257#issuecomment-4777978820

   We need behavior tests result. Run
   
   OPENDAL_TEST=onedrive cargo test behavior --features services-onedrive
   
   The above command needs modification with credentials and exact commands. You should be able to find instructions in contributing doc.


-- 
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: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(services/onedrive): fix url of onedrive_create_upload_session [opendal]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #7257:
URL: https://github.com/apache/opendal/pull/7257#discussion_r3427117400


##########
core/services/onedrive/src/graph_model.rs:
##########
@@ -146,7 +146,7 @@ pub struct OneDriveUploadSessionCreationResponseBody {
 
 #[derive(Debug, Clone, Serialize, Deserialize)]
 pub struct OneDriveUploadSessionCreationRequestBody {
-    item: FileUploadItem,
+    pub item: FileUploadItem,

Review Comment:
   These changes make previously-internal Graph request models part of the public crate API (`pub struct` + `pub` fields). That’s a potentially permanent API surface area that external consumers may start depending on. If this visibility is only needed for tests/other internal modules, prefer `pub(crate)` (or keep fields private and validate via `serde_json::Value` in tests) to avoid unintentionally committing to these types as public API.



##########
core/services/onedrive/src/graph_model.rs:
##########
@@ -131,10 +131,10 @@ impl CreateDirPayload {
 struct EmptyStruct {}
 
 #[derive(Debug, Clone, Serialize, Deserialize)]
-struct FileUploadItem {
+pub struct FileUploadItem {
     #[serde(rename = "@microsoft.graph.conflictBehavior")]
-    conflict_behavior: String,
-    name: String,
+    pub conflict_behavior: String,
+    pub name: String,

Review Comment:
   These changes make previously-internal Graph request models part of the public crate API (`pub struct` + `pub` fields). That’s a potentially permanent API surface area that external consumers may start depending on. If this visibility is only needed for tests/other internal modules, prefer `pub(crate)` (or keep fields private and validate via `serde_json::Value` in tests) to avoid unintentionally committing to these types as public API.



##########
core/services/onedrive/src/core.rs:
##########
@@ -750,3 +758,62 @@ impl OneDriveSigner {
         Ok(())
     }
 }
+
+#[cfg(test)]
+mod tests {
+    use serde::Deserialize;
+
+    use crate::ONEDRIVE_SCHEME;
+
+    use super::*;
+
+    fn get_request_json_body<T: for<'a> Deserialize<'a>>(request: Request<Buffer>) -> T {

Review Comment:
   The bound `for<'a> Deserialize<'a>` is harder to read than necessary for owned deserialization. Using `serde::de::DeserializeOwned` is the conventional, clearer trait bound for `from_slice` into an owned type, and communicates intent more directly.



-- 
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: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(services/onedrive): fix url of onedrive_create_upload_session [opendal]

Posted by "emliunix (via GitHub)" <gi...@apache.org>.
emliunix commented on PR #7257:
URL: https://github.com/apache/opendal/pull/7257#issuecomment-4747211429

   @Xuanwo When you get a chance, please take a look at this PR. It fixes the big file upload bug, and I have refined the PR with tests as suggested. Or maybe I can refine the PR further if there're more input.


-- 
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: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(services/onedrive): fix url of onedrive_create_upload_session [opendal]

Posted by "erickguan (via GitHub)" <gi...@apache.org>.
erickguan commented on code in PR #7257:
URL: https://github.com/apache/opendal/pull/7257#discussion_r3458706975


##########
core/services/onedrive/src/graph_model.rs:
##########
@@ -146,7 +146,7 @@ pub struct OneDriveUploadSessionCreationResponseBody {
 
 #[derive(Debug, Clone, Serialize, Deserialize)]
 pub struct OneDriveUploadSessionCreationRequestBody {
-    item: FileUploadItem,
+    pub item: FileUploadItem,

Review Comment:
   Please use pub(crate) instead.



-- 
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: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(services/onedrive): fix url of onedrive_create_upload_session [opendal]

Posted by "erickguan (via GitHub)" <gi...@apache.org>.
erickguan closed pull request #7257: fix(services/onedrive): fix url of onedrive_create_upload_session
URL: https://github.com/apache/opendal/pull/7257


-- 
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: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(services/onedrive): fix url of onedrive_create_upload_session [opendal]

Posted by "emliunix (via GitHub)" <gi...@apache.org>.
emliunix commented on code in PR #7257:
URL: https://github.com/apache/opendal/pull/7257#discussion_r3427145746


##########
core/services/onedrive/src/graph_model.rs:
##########
@@ -146,7 +146,7 @@ pub struct OneDriveUploadSessionCreationResponseBody {
 
 #[derive(Debug, Clone, Serialize, Deserialize)]
 pub struct OneDriveUploadSessionCreationRequestBody {
-    item: FileUploadItem,
+    pub item: FileUploadItem,

Review Comment:
   There's no opendal core API can take these structs, so it's safe. And also making them pub actually follows the convention of the other models in the same file.



-- 
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: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(services/onedrive): fix url of onedrive_create_upload_session [opendal]

Posted by "erickguan (via GitHub)" <gi...@apache.org>.
erickguan commented on code in PR #7257:
URL: https://github.com/apache/opendal/pull/7257#discussion_r3458706975


##########
core/services/onedrive/src/graph_model.rs:
##########
@@ -146,7 +146,7 @@ pub struct OneDriveUploadSessionCreationResponseBody {
 
 #[derive(Debug, Clone, Serialize, Deserialize)]
 pub struct OneDriveUploadSessionCreationRequestBody {
-    item: FileUploadItem,
+    pub item: FileUploadItem,

Review Comment:
   Please use pub(crate) instead.



-- 
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: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(services/onedrive): fix url of onedrive_create_upload_session [opendal]

Posted by "erickguan (via GitHub)" <gi...@apache.org>.
erickguan commented on PR #7257:
URL: https://github.com/apache/opendal/pull/7257#issuecomment-5301119051

   A rebased, live-tested replacement is now available in #8080. It covers the upload-session URL issue, adds root and percent-encoded path regression tests, and passes the full OneDrive behavior suite: 121 passed, 0 failed.


-- 
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: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org