Skip to content

Commit

Permalink
Safety measure to prevent possible incorrect padding
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-kotliar committed Nov 18, 2021
1 parent 2e75ef9 commit ca14232
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cwl_airflow/utilities/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,13 @@ def get_uncompressed(data_str, parse_as_yaml=None):
try:
uncompressed = gzip.decompress(
base64.b64decode(
data_str.encode("utf-8")
data_str.encode("utf-8") + b'==' # safety measure to prevent incorrect padding error
)
).decode("utf-8")
except Exception:
uncompressed = zlib.decompress(
base64.b64decode(
data_str.encode("utf-8")
data_str.encode("utf-8") + b'==' # safety measure to prevent incorrect padding error
)
).decode("utf-8")
return load_yaml(uncompressed) if parse_as_yaml else uncompressed
Expand Down

0 comments on commit ca14232

Please sign in to comment.