mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-10-29 21:50:16 +01:00
Handle another fix after 57119c1b30
This commit is contained in:
parent
7db8b3b532
commit
96ba53d916
@ -43,6 +43,9 @@ def my_open(*args, **kwargs):
|
||||
with original_open(*args, **kwargs) as f:
|
||||
file_contents = f.read()
|
||||
|
||||
if len(args) > 1 and args[1] == 'rb':
|
||||
file_contents = file_contents.decode('utf-8')
|
||||
|
||||
file_contents = file_contents.replace('\t\t<script\n\t\t\tsrc="https://cdnjs.cloudflare.com/ajax/libs/iframe-resizer/4.3.9/iframeResizer.contentWindow.min.js"\n\t\t\tasync\n\t\t></script>', '')
|
||||
file_contents = file_contents.replace('cdnjs.cloudflare.com', '127.0.0.1')
|
||||
file_contents = file_contents.replace(
|
||||
@ -55,7 +58,12 @@ def my_open(*args, **kwargs):
|
||||
'\n </head>'
|
||||
)
|
||||
|
||||
return io.StringIO(file_contents)
|
||||
if len(args) > 1 and args[1] == 'rb':
|
||||
file_contents = file_contents.encode('utf-8')
|
||||
return io.BytesIO(file_contents)
|
||||
else:
|
||||
return io.StringIO(file_contents)
|
||||
|
||||
else:
|
||||
return original_open(*args, **kwargs)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user