Skip to content

Commit

Permalink
With --external, save HTML to a file rather than using 'data:' URL
Browse files Browse the repository at this point in the history
Per private communication, the 'data:' URL might not work in some cases, and
it's probably difficult to debug and diagnose such bugs.
  • Loading branch information
dlenski committed Jul 8, 2024
1 parent 88027bb commit 29a4a2a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion gp_saml_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
import xml.etree.ElementTree as ET
import ssl
import tempfile
import pathlib
import os

from operator import setitem
from os import path, dup2, execvp, environ
Expand Down Expand Up @@ -380,7 +382,9 @@ def main(args = None):
print("Got SAML %s, opening external browser for debugging..." % sam, file=stderr)
import webbrowser
if html:
uri = 'data:text/html;base64,' + b2a_base64(html.encode()).decode()
with tempfile.NamedTemporaryFile(suffix='.html', mode='w', delete=False) as tf:
tf.write(html)
uri = pathlib.Path(tf.name).as_uri()
webbrowser.open(uri)
raise SystemExit

Expand Down

0 comments on commit 29a4a2a

Please sign in to comment.