RunOrVeith opened a new issue, #1682:
URL: https://github.com/apache/libcloud/issues/1682

   ## Summary
   
   When requesting a blob from google storage that is public (it works for 
private buckets), Google seems to have suddenly stopped sending the `etag` 
header. Unfortunately, this is required in `_headers_to_object`, which now 
crashes.
   This means no files on a public bucket can be accessed any more at the 
moment.
   
   
   ## Detailed Information
   ```python
   from libcloud.storage.providers import Provider, get_driver
   key = ""  # add your key here
   secret = "" # add your secret here
   
   # Make sure this points to a public blob, it works for private buckets
   container_name = ""  # add a container name here
   object_name = ""  #  add the object name here
   
   driver_type = get_driver(provider=Provider.GOOGLE_STORAGE)
   driver = driver_type(key=key,  secret=secret)
   driver.get_object(
       container_name=container_name,
       object_name=object_name
   )
   ```
   
   Results in the following error:
   
   ```
   Traceback (most recent call last):
     File "/home/veith/.config/JetBrains/PyCharm2022.1/scratches/scratch_1.py", 
line 12, in <module>
       driver.get_object(
     File 
"/home/veith/Projects/.venv/lib/python3.8/site-packages/libcloud/storage/drivers/s3.py",
 line 412, in get_object
       obj = self._headers_to_object(
     File 
"/home/veith/Projects/.venv/lib/python3.8/site-packages/libcloud/storage/drivers/s3.py",
 line 1195, in _headers_to_object
       hash = headers["etag"].replace('"', "")
   KeyError: 'etag'
   ```
   
   The problem are the first 2 lines in s3.py:
   
   ```python
       def _headers_to_object(self, object_name, container, headers):
           hash = headers["etag"].replace('"', "")  # expects etag to be 
present and will crash
           extra = {"content_type": headers["content-type"], "etag": 
headers["etag"]}
           meta_data = {}
   ```
   
   Libcloud 3.5.1, Ubuntu 18.04, Python 3.8
   
   I will try to create a fix ASAP
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@libcloud.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to