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

OneDrive for Business support #29

Merged
merged 10 commits into from
Aug 29, 2016
Merged

OneDrive for Business support #29

merged 10 commits into from
Aug 29, 2016

Conversation

rootik
Copy link
Contributor

@rootik rootik commented Aug 24, 2016

Hello
Thank you for a great script. I have added OneDrive for business support as a separate script/configuration. OneDrive for Business API is significantly different from OneDrive Personal API.
Feel free to discuss this pull request.

rootik

@fkalis
Copy link
Owner

fkalis commented Aug 24, 2016

Hello and thank you for your contribution. I really appreciate this, but before I accept your pull request, I will take a closer look at the source code, especially at the newly introduced function curl_discover_uri and its usage.

@fkalis
Copy link
Owner

fkalis commented Aug 24, 2016

I am not able to test your implementation due to the lack of an Azure account.

Please make sure that both simple uploads and chunked uploads work (both implementations still exist, so I assume both ways should work with OneDrive for Business) for existing folders, the root folder, and a non-existing folder.

@rootik
Copy link
Contributor Author

rootik commented Aug 25, 2016

Hello.
I revised the code. You are right, api_base_url was a relict.
I experimented with chunked upload and now it works as it should.
This is a part of debug output from my test:

2016-08-25 11:09:47 Uploading chunk 24 of 'largefile.dat'
2016-08-25 11:09:47 Content-Length: 7864320
2016-08-25 11:09:47 Content-Range: bytes 243793920-251658239/251658240
2016-08-25 11:09:51 Status code: 201
2016-08-25 11:09:51 Upload of chunk 24 of 'largefile.dat' finished (Code: 201)
Successfully uploaded 'largefile.dat' as 'largefile.dat'

@rootik
Copy link
Contributor Author

rootik commented Aug 25, 2016

BTW, simple file upload works for this large file too :)

@rootik
Copy link
Contributor Author

rootik commented Aug 25, 2016

Chunked uploading to non-existent folder test:

./onedriveb-upload -d -f test largefile.dat
2016-08-25 13:25:57 Searching for 'test' in ''
2016-08-25 13:25:58 Creating folder 'test' in ''
2016-08-25 13:26:00 api_folder_id is now '01KB37ZVT6RYOY5M6DDVEKCMBR6DX7C26Q'
2016-08-25 13:26:00 Size of largefile.dat is more than 104857600 bytes, will use chunked upload
2016-08-25 13:26:04 Requesting upload session for 'largefile.dat'
2016-08-25 13:26:04 Uploading 'largefile.dat' as 'largefile.dat' into 01KB37ZVT6RYOY5M6DDVEKCMBR6DX7C26Q
2016-08-25 13:26:07 Uploading chunk 0 of 'largefile.dat'
2016-08-25 13:26:07 Content-Length: 10158080
2016-08-25 13:26:07 Content-Range: bytes 0-10158079/251658240
2016-08-25 13:26:10 Status code: 202
2016-08-25 13:26:10 Upload of chunk 0 of 'largefile.dat' finished (Code: 202)
2016-08-25 13:26:12 Uploading chunk 1 of 'largefile.dat'
2016-08-25 13:26:12 Content-Length: 10158080
2016-08-25 13:26:12 Content-Range: bytes 10158080-20316159/251658240
2016-08-25 13:26:15 Status code: 202
....

@rootik
Copy link
Contributor Author

rootik commented Aug 25, 2016

Simple file upload to non-existent nested folder:

./onedriveb-upload -d -f Backup/test README.md
2016-08-25 13:36:26 Searching for 'Backup' in ''
2016-08-25 13:36:27 Searching for 'test' in '01KB37ZVTBLCBYMBMQMJAKFVVCBYYFLH4Q'
2016-08-25 13:36:28 Creating folder 'test' in '01KB37ZVTBLCBYMBMQMJAKFVVCBYYFLH4Q'
2016-08-25 13:36:29 api_folder_id is now '01KB37ZVS53G3I4AJZUVEJPAKODSMI5TWE'
2016-08-25 13:36:29 Size of README.md is less than or equal to 104857600 bytes, will use simple upload
2016-08-25 13:36:33 Uploading 'README.md' as 'README.md' into 01KB37ZVS53G3I4AJZUVEJPAKODSMI5TWE
Successfully uploaded 'README.md' as 'README.md'

@fkalis fkalis merged commit d9916c1 into fkalis:master Aug 29, 2016
@fkalis
Copy link
Owner

fkalis commented Aug 29, 2016

Thank you for your contribution. I have just merged your additional script into the master branch.

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

Successfully merging this pull request may close these issues.

None yet

2 participants