-
Notifications
You must be signed in to change notification settings - Fork 252
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
InvalidRequest Error when using UploadSession to upload files to OneDrive #2599
Comments
Thanks for raising this @lavinir Any chance you can share what is being done to sanitize the name in the |
Hi @andrueastman, Sure, this just strips the suffix and then removes illegal chars from the string using this logic: if (string.IsNullOrEmpty(input))
{
return input;
}
char[] illegalChars = { '*', ':', '<', '>', '?', '/', '\\', '|' };
string sanitizedString = new string(input.Select(c => illegalChars.Contains(c) ? '_' : c).ToArray());
return sanitizedString; |
Thanks for the extra information here @lavinir Are you by any chance able to capture the filename in these scenarios? Ideally, the one drive API should be having the same naming restrictions to
|
Thanks @andrueastman . |
Here is an example of a file name: "hass_backup_2024-08-05-12-57.tar" |
Thanks for the extra information here @lavinir
Are you able to confirm if the description is very long or with special characters in this scenario? |
I apologize @andrueastman , Did not get this notification. No, the description should not have any special chars or be very long. |
Describe the bug
I am trying to upload files to the special App Folder in OneDrive. The code runs on multiple machines but some of them are getting errors attempting to upload files (each machine is using a different OneDrive account).
The Error being thrown is:
No additional data indicating why the request is invalid or what might be causing the error.
Expected behavior
The upload session is created successfully and file upload goes through. (Or an appropriate error message explaining what's wrong with the request comes back)
How to reproduce
The code I am using to create the session:
SDK Version
5.38.0
Latest version known to work for scenario above?
No response
Known Workarounds
None - Works in some instances and fails in others.
The things that are different in each machine:
Debug output
Click to expand log
``` Error uploading backup: Microsoft.Graph.Models.ODataErrors.ODataError: Invalid request at Microsoft.Kiota.Http.HttpClientLibrary.HttpClientRequestAdapter.ThrowIfFailedResponse(HttpResponseMessage response, Dictionary2 errorMapping, Activity activityForAttributes, CancellationToken cancellationToken) at Microsoft.Kiota.Http.HttpClientLibrary.HttpClientRequestAdapter.SendAsync[ModelType](RequestInformation requestInfo, ParsableFactory1 factory, Dictionary2 errorMapping, CancellationToken cancellationToken) at Microsoft.Kiota.Http.HttpClientLibrary.HttpClientRequestAdapter.SendAsync[ModelType](RequestInformation requestInfo, ParsableFactory1 factory, Dictionary2 errorMapping, CancellationToken cancellationToken) at Microsoft.Graph.Drives.Item.Items.Item.CreateUploadSession.CreateUploadSessionRequestBuilder.PostAsync(CreateUploadSessionPostRequestBody body, Action1 requestConfiguration, CancellationToken cancellationToken) ```Configuration
Mix of architectures (x64, ARM64, ARM)
Other information
No response
The text was updated successfully, but these errors were encountered: