Skip to content

Commit aabe8be

Browse files
committed
Merge branch 'feature/onedrive-auth-headers' into develop
[ENG-7287] Closes #415
2 parents 1e7df8a + 70f38df commit aabe8be

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

.github/workflows/test-build.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
python-version: ${{ matrix.python-version }}
2222
- name: Cache Build Requirements
2323
id: pip-cache-step
24-
uses: actions/cache@v2
24+
uses: actions/cache@v4
2525
with:
2626
path: ${{ env.pythonLocation }}
2727
key: ${{ env.GHA_DISTRO }}-${{ env.pythonLocation }}-${{ hashFiles('requirements.txt', 'dev-requirements.txt') }}
@@ -44,7 +44,7 @@ jobs:
4444
with:
4545
python-version: 3.6
4646
- name: Cache pip
47-
uses: actions/cache@v2
47+
uses: actions/cache@v4
4848
with:
4949
path: ${{ env.pythonLocation }}
5050
key: ${{ env.GHA_DISTRO }}-${{ env.pythonLocation }}-${{ hashFiles('requirements.txt', 'dev-requirements.txt') }}

tests/providers/onedrive/test_provider.py

-1
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,6 @@ async def test_download_standard_file_range(self, provider, download_fixtures):
516516
assert content == b'te'
517517
assert aiohttpretty.has_call(method='GET', uri=download_url,
518518
headers={'Range': 'bytes=0-1',
519-
'Authorization': 'bearer wrote harry potter',
520519
'accept-encoding': ''})
521520

522521
@pytest.mark.asyncio

waterbutler/providers/onedrive/provider.py

+2
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ async def download(self, # type: ignore
310310
'GET',
311311
download_url,
312312
range=range,
313+
no_auth_header=True, # if download_url is signed, OD will sometimes 401 if auth header is included
313314
expects=(HTTPStatus.OK, HTTPStatus.PARTIAL_CONTENT),
314315
headers={'accept-encoding': ''},
315316
throws=exceptions.DownloadError,
@@ -766,6 +767,7 @@ async def _chunked_upload_stream_by_range(self, upload_url, data, start_range=0,
766767
start_range + len(data) - 1,
767768
total_size)
768769
},
770+
no_auth_header=True, # this endpoint will sometimes 401 if the Auth header included
769771
expects=(HTTPStatus.ACCEPTED, HTTPStatus.CREATED),
770772
throws=exceptions.UploadError
771773
)

0 commit comments

Comments
 (0)