Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-google-resumable-media for 
openSUSE:Factory checked in at 2023-03-07 16:50:54
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-google-resumable-media (Old)
 and      /work/SRC/openSUSE:Factory/.python-google-resumable-media.new.31432 
(New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-google-resumable-media"

Tue Mar  7 16:50:54 2023 rev:16 rq:1069913 version:2.4.1

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/python-google-resumable-media/python-google-resumable-media.changes
      2022-10-17 14:58:45.810215323 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-google-resumable-media.new.31432/python-google-resumable-media.changes
   2023-03-07 16:51:21.305907167 +0100
@@ -1,0 +2,9 @@
+Tue Mar  7 10:30:15 UTC 2023 - John Paul Adrian Glaubitz 
<adrian.glaub...@suse.com>
+
+- Update to 2.4.1
+  Bug Fixes
+  * Avoid validating checksums for partial responses (#361)
+- Drop patches for issues fixed upstream
+  * python-google-resumable-media-no-mock.patch
+
+-------------------------------------------------------------------

Old:
----
  google-resumable-media-2.4.0.tar.gz
  python-google-resumable-media-no-mock.patch

New:
----
  google-resumable-media-2.4.1.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-google-resumable-media.spec ++++++
--- /var/tmp/diff_new_pack.3gdsMi/_old  2023-03-07 16:51:21.897910289 +0100
+++ /var/tmp/diff_new_pack.3gdsMi/_new  2023-03-07 16:51:21.901910310 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package python-google-resumable-media
 #
-# Copyright (c) 2022 SUSE LLC
+# Copyright (c) 2023 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -19,15 +19,13 @@
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 %define skip_python2 1
 Name:           python-google-resumable-media
-Version:        2.4.0
+Version:        2.4.1
 Release:        0
 Summary:        Utilities for Google Media Downloads and Resumable Uploads
 License:        Apache-2.0
 Group:          Development/Languages/Python
 URL:            https://github.com/googleapis/google-resumable-media-python
 Source:         
https://files.pythonhosted.org/packages/source/g/google-resumable-media/google-resumable-media-%{version}.tar.gz
-# 
https://github.com/googleapis/google-resumable-media-python/commit/82f9769f3368404d1854dd22eeed34eeb25ea835
-Patch0:         python-google-resumable-media-no-mock.patch
 BuildRequires:  %{python_module google-auth}
 BuildRequires:  %{python_module google-crc32c}
 BuildRequires:  %{python_module pip}
@@ -48,7 +46,6 @@
 
 %prep
 %setup -q -n google-resumable-media-%{version}
-%patch0 -p1
 
 %build
 %pyproject_wheel

++++++ google-resumable-media-2.4.0.tar.gz -> 
google-resumable-media-2.4.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/google-resumable-media-2.4.0/PKG-INFO 
new/google-resumable-media-2.4.1/PKG-INFO
--- old/google-resumable-media-2.4.0/PKG-INFO   2022-09-29 23:58:29.030800000 
+0200
+++ new/google-resumable-media-2.4.1/PKG-INFO   2023-01-19 22:32:45.372634000 
+0100
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: google-resumable-media
-Version: 2.4.0
+Version: 2.4.1
 Summary: Utilities for Google Media Downloads and Resumable Uploads
 Home-page: https://github.com/googleapis/google-resumable-media-python
 Author: Google Cloud Platform
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/google-resumable-media-2.4.0/google/_async_resumable_media/requests/__init__.py
 
new/google-resumable-media-2.4.1/google/_async_resumable_media/requests/__init__.py
--- 
old/google-resumable-media-2.4.0/google/_async_resumable_media/requests/__init__.py
 2022-09-29 23:54:59.000000000 +0200
+++ 
new/google-resumable-media-2.4.1/google/_async_resumable_media/requests/__init__.py
 2023-01-19 22:29:29.000000000 +0100
@@ -286,6 +286,10 @@
 In addition, a :class:`.ChunkedDownload` can also take optional
 ``start`` and ``end`` byte positions.
 
+Usually, no checksum is returned with a chunked download. Even if one is 
returned,
+it is not validated. If you need to validate the checksum, you can do so
+by buffering the chunks and validating the checksum against the completed 
download.
+
 ==============
 Simple Uploads
 ==============
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/google-resumable-media-2.4.0/google/_async_resumable_media/requests/download.py
 
new/google-resumable-media-2.4.1/google/_async_resumable_media/requests/download.py
--- 
old/google-resumable-media-2.4.0/google/_async_resumable_media/requests/download.py
 2022-09-29 23:54:59.000000000 +0200
+++ 
new/google-resumable-media-2.4.1/google/_async_resumable_media/requests/download.py
 2023-01-19 22:29:29.000000000 +0100
@@ -15,6 +15,7 @@
 """Support for downloading media from Google APIs."""
 
 import urllib3.response  # type: ignore
+import http
 
 from google._async_resumable_media import _download
 from google._async_resumable_media import _helpers
@@ -90,7 +91,11 @@
             self._stream.write(chunk)
             local_checksum_object.update(chunk)
 
-        if expected_checksum is not None:
+        # Don't validate the checksum for partial responses.
+        if (
+            expected_checksum is not None
+            and response.status != http.client.PARTIAL_CONTENT
+        ):
             actual_checksum = sync_helpers.prepare_checksum_digest(
                 checksum_object.digest()
             )
@@ -213,7 +218,11 @@
             self._stream.write(chunk)
             checksum_object.update(chunk)
 
-        if expected_checksum is not None:
+        # Don't validate the checksum for partial responses.
+        if (
+            expected_checksum is not None
+            and response.status != http.client.PARTIAL_CONTENT
+        ):
             actual_checksum = sync_helpers.prepare_checksum_digest(
                 checksum_object.digest()
             )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/google-resumable-media-2.4.0/google/resumable_media/requests/__init__.py 
new/google-resumable-media-2.4.1/google/resumable_media/requests/__init__.py
--- 
old/google-resumable-media-2.4.0/google/resumable_media/requests/__init__.py    
    2022-09-29 23:54:59.000000000 +0200
+++ 
new/google-resumable-media-2.4.1/google/resumable_media/requests/__init__.py    
    2023-01-19 22:29:29.000000000 +0100
@@ -286,6 +286,10 @@
 In addition, a :class:`.ChunkedDownload` can also take optional
 ``start`` and ``end`` byte positions.
 
+Usually, no checksum is returned with a chunked download. Even if one is 
returned,
+it is not validated. If you need to validate the checksum, you can do so
+by buffering the chunks and validating the checksum against the completed 
download.
+
 ==============
 Simple Uploads
 ==============
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/google-resumable-media-2.4.0/google/resumable_media/requests/download.py 
new/google-resumable-media-2.4.1/google/resumable_media/requests/download.py
--- 
old/google-resumable-media-2.4.0/google/resumable_media/requests/download.py    
    2022-09-29 23:54:59.000000000 +0200
+++ 
new/google-resumable-media-2.4.1/google/resumable_media/requests/download.py    
    2023-01-19 22:29:29.000000000 +0100
@@ -15,6 +15,7 @@
 """Support for downloading media from Google APIs."""
 
 import urllib3.response  # type: ignore
+import http
 
 from google.resumable_media import _download
 from google.resumable_media import common
@@ -124,7 +125,11 @@
                 self._bytes_downloaded += len(chunk)
                 local_checksum_object.update(chunk)
 
-        if expected_checksum is not None:
+        # Don't validate the checksum for partial responses.
+        if (
+            expected_checksum is not None
+            and response.status_code != http.client.PARTIAL_CONTENT
+        ):
             actual_checksum = 
_helpers.prepare_checksum_digest(checksum_object.digest())
             if actual_checksum != expected_checksum:
                 msg = _CHECKSUM_MISMATCH.format(
@@ -308,7 +313,11 @@
                 checksum_object.update(chunk)
             response._content_consumed = True
 
-        if expected_checksum is not None:
+        # Don't validate the checksum for partial responses.
+        if (
+            expected_checksum is not None
+            and response.status_code != http.client.PARTIAL_CONTENT
+        ):
             actual_checksum = 
_helpers.prepare_checksum_digest(checksum_object.digest())
 
             if actual_checksum != expected_checksum:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/google-resumable-media-2.4.0/google_resumable_media.egg-info/PKG-INFO 
new/google-resumable-media-2.4.1/google_resumable_media.egg-info/PKG-INFO
--- old/google-resumable-media-2.4.0/google_resumable_media.egg-info/PKG-INFO   
2022-09-29 23:58:28.000000000 +0200
+++ new/google-resumable-media-2.4.1/google_resumable_media.egg-info/PKG-INFO   
2023-01-19 22:32:45.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: google-resumable-media
-Version: 2.4.0
+Version: 2.4.1
 Summary: Utilities for Google Media Downloads and Resumable Uploads
 Home-page: https://github.com/googleapis/google-resumable-media-python
 Author: Google Cloud Platform
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/google-resumable-media-2.4.0/setup.py 
new/google-resumable-media-2.4.1/setup.py
--- old/google-resumable-media-2.4.0/setup.py   2022-09-29 23:54:59.000000000 
+0200
+++ new/google-resumable-media-2.4.1/setup.py   2023-01-19 22:29:29.000000000 
+0100
@@ -35,7 +35,7 @@
 
 setuptools.setup(
     name='google-resumable-media',
-    version = "2.4.0",
+    version = "2.4.1",
     description='Utilities for Google Media Downloads and Resumable Uploads',
     author='Google Cloud Platform',
     author_email='googleapis-publis...@google.com',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/google-resumable-media-2.4.0/tests/unit/requests/test_download.py 
new/google-resumable-media-2.4.1/tests/unit/requests/test_download.py
--- old/google-resumable-media-2.4.0/tests/unit/requests/test_download.py       
2022-09-29 23:54:59.000000000 +0200
+++ new/google-resumable-media-2.4.1/tests/unit/requests/test_download.py       
2023-01-19 22:29:29.000000000 +0100
@@ -114,6 +114,35 @@
             chunk_size=_request_helpers._SINGLE_GET_CHUNK_SIZE, 
decode_unicode=False
         )
 
+    @pytest.mark.parametrize("checksum", ["md5", "crc32c"])
+    def test__write_to_stream_no_checksum_validation_for_partial_response(
+        self, checksum
+    ):
+        stream = io.BytesIO()
+        download = download_mod.Download(EXAMPLE_URL, stream=stream, 
checksum=checksum)
+
+        chunk1 = b"first chunk"
+        response = _mock_response(
+            status_code=http.client.PARTIAL_CONTENT, chunks=[chunk1]
+        )
+
+        # Make sure that the checksum is not validated.
+        with mock.patch(
+            "google.resumable_media._helpers.prepare_checksum_digest",
+            return_value=None,
+        ) as prepare_checksum_digest:
+            download._write_to_stream(response)
+            assert not prepare_checksum_digest.called
+
+        assert not download.finished
+
+        # Check mocks.
+        response.__enter__.assert_called_once_with()
+        response.__exit__.assert_called_once_with(None, None, None)
+        response.iter_content.assert_called_once_with(
+            chunk_size=_request_helpers._SINGLE_GET_CHUNK_SIZE, 
decode_unicode=False
+        )
+
     def test__write_to_stream_with_invalid_checksum_type(self):
         BAD_CHECKSUM_TYPE = "badsum"
 

Reply via email to