Skip to content

Commit

Permalink
Merge pull request #340 from buffer/atob
Browse files Browse the repository at this point in the history
atob() function minor improvement
  • Loading branch information
buffer authored Nov 16, 2022
2 parents c2c5fd2 + ac5e3cd commit 167fa76
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
2 changes: 1 addition & 1 deletion tests/functional/test_misc_ie90.py
Original file line number Diff line number Diff line change
Expand Up @@ -1266,7 +1266,7 @@ def test_testPlayStateChange(self, caplog):
def test_testAtob(self, caplog):
sample = os.path.join(self.misc_path, "testAtob.html")
expected = ['Encoded String: SGVsbG8gV29ybGQ=',
'Decoded String: Hello World']
'Decoded String: b\'Hello World\'']

self.do_perform_test(caplog, sample, expected)

Expand Down
5 changes: 1 addition & 4 deletions thug/DOM/Window.py
Original file line number Diff line number Diff line change
Expand Up @@ -1056,10 +1056,7 @@ def atob(self, s):
"""
The atob method decodes a base-64 encoded string
"""
if isinstance(s, str):
s = s.encode()

return base64.b64decode(s)
return str(base64.b64decode(s))

def btoa(self, s):
"""
Expand Down

0 comments on commit 167fa76

Please sign in to comment.