Ver Fonte

[ABFS] Fix reading file operation by 1 byte (#3470)

- When trying to read the file, we are giving wrong endByte value as per https://learn.microsoft.com/en-us/rest/api/storageservices/specifying-the-range-header-for-blob-service-operations#format-2-bytesstartbyte-endbyte.

- We were reading 1 byte extra for every 1MB chunk size value i.e instead of 0-1023 we were sending 0-1024. This was messing up with the downloaded file and lead to truncation of end bytes to fit the downloaded size. 

Header['range'] = headers['range'] = 'bytes=x-y' in this x is starting point and y is end point and both are included hence we removed the 1 byte from y to make sure we are not duplicating the bytes.

- We checked and this issue is only for ABFS, other FS in Hue should not show this behaviour.
Ayush Goyal há 2 anos atrás
pai
commit
aa85b51a5d
1 ficheiros alterados com 2 adições e 2 exclusões
  1. 2 2
      desktop/libs/azure/src/azure/abfs/abfs.py

+ 2 - 2
desktop/libs/azure/src/azure/abfs/abfs.py

@@ -408,8 +408,8 @@ class ABFS(object):
     """
     path = Init_ABFS.strip_scheme(path)
     headers = self._getheaders()
-    if length != 0 and length != '0':
-      headers['range'] = 'bytes=%s-%s' % (str(offset), str(int(offset) + int(length)))
+    if length > 0 and length > '0':
+      headers['range'] = 'bytes=%s-%s' % (str(offset), str(int(offset) + int(length) - 1))
 
     return self._root.get(path, headers=headers)