Skip to content

Commit b0ce3b0

Browse files
evoldstadFizzadar
authored andcommitted
pyinfra/connectors: Fixed broken get for non-utf8 files (#1208)
A small fix that allows the example in issue #1207 to work.
1 parent 838737e commit b0ce3b0

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

pyinfra/connectors/chroot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ def get_file(
174174
)
175175

176176
# Load the temporary file and write it to our file or IO object
177-
with open(temp_filename, encoding="utf-8") as temp_f:
177+
with open(temp_filename, "rb") as temp_f:
178178
with get_file_io(filename_or_io, "wb") as file_io:
179179
data = temp_f.read()
180180
data_bytes: bytes

pyinfra/connectors/local.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ def get_file(
184184
raise IOError(output.stderr)
185185

186186
# Load our file or IO object and write it to the temporary file
187-
with open(temp_filename, encoding="utf-8") as temp_f:
187+
with open(temp_filename, "rb") as temp_f:
188188
with get_file_io(filename_or_io, "wb") as file_io:
189189
data_bytes: bytes
190190

0 commit comments

Comments
 (0)