You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by ka...@apache.org on 2021/01/29 07:48:40 UTC

[airflow] branch master updated: Fix reading from zip package to default to text (#13962)

This is an automated email from the ASF dual-hosted git repository.

kamilbregula pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/master by this push:
     new cc70227  Fix reading from zip package to default to text (#13962)
cc70227 is described below

commit cc70227d9be25be5ce95c0dae4383c3883819d68
Author: Lev Himmelfarb <le...@boylesoftware.com>
AuthorDate: Fri Jan 29 02:48:14 2021 -0500

    Fix reading from zip package to default to text (#13962)
---
 airflow/utils/file.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/airflow/utils/file.py b/airflow/utils/file.py
index 553c506..8c48aad 100644
--- a/airflow/utils/file.py
+++ b/airflow/utils/file.py
@@ -15,6 +15,7 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
+import io
 import logging
 import os
 import re
@@ -84,7 +85,7 @@ def open_maybe_zipped(fileloc, mode='r'):
     """
     _, archive, filename = ZIP_REGEX.search(fileloc).groups()
     if archive and zipfile.is_zipfile(archive):
-        return zipfile.ZipFile(archive, mode=mode).open(filename)
+        return io.TextIOWrapper(zipfile.ZipFile(archive, mode=mode).open(filename))
     else:
         return open(fileloc, mode=mode)