Skip to content
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

About uploadToSession 401 #39

Open
Luoooio opened this issue Jun 17, 2024 · 1 comment
Open

About uploadToSession 401 #39

Luoooio opened this issue Jun 17, 2024 · 1 comment

Comments

@Luoooio
Copy link

Luoooio commented Jun 17, 2024

It is now June 17, 2024. While using a self-developed upload tool and testing your tool, I discovered that uploading large files using the session endpoint results in a 401 error. After some research, I modified the code in the httpSendFilePart function by commenting out the Authorization part, which made the endpoint work successfully. I speculate that Microsoft standardized the API in June, and when using PUT to the uploadurl, it checks for Authorization. If it exists, the request will fail, although I don't understand the significance of this.

	requestHeaders := make(HTTPRequestParams)
	requestHeaders["Content-Type"] = mimeType
	requestHeaders["Content-Length"] = strconv.FormatInt(n, 10)
	requestHeaders["Content-Range"] = "bytes " + strconv.FormatInt(offset, 10) + "-" + strconv.FormatInt(n+offset-1, 10) + "/" + strconv.FormatInt(fileSize, 10)
	//if client.AccessToken != "" {
	//	requestHeaders["Authorization"] = "Bearer " + client.AccessToken
	//}
	return client.httpRequest(method, uri, requestHeaders, nil, data, progress)
}```
@joaobosconff
Copy link

Could you create a PR? maybe the author approve

Your solution saved my day!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants