Skip to content

Commit a922734

Browse files
committed
Fixed links to log files not working with custom outputs path
1 parent 19e5757 commit a922734

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

modules/util.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
from datetime import datetime, timedelta
21
import random
32
import os
3+
import modules.path
4+
5+
from datetime import datetime, timedelta
46

57

68
def remove_empty_str(items, default=None):
@@ -32,7 +34,13 @@ def generate_temp_filename(folder='./outputs/', extension='png', base=None):
3234
return date_string, os.path.abspath(os.path.realpath(result)), filename
3335

3436

35-
def get_log_path(time, folder='./outputs/'):
37+
def get_log_path(time):
38+
current_dir = os.path.abspath(os.curdir)
39+
outputs_dir = os.path.abspath(modules.path.temp_outputs_path)
40+
if outputs_dir.startswith(current_dir):
41+
folder = os.path.relpath(outputs_dir, current_dir)
42+
else:
43+
folder = outputs_dir
3644
return os.path.join(folder, time.strftime("%Y-%m-%d"), 'log.html')
3745

3846

update_log_mre.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
### 2.0.19 MRE
2+
3+
* Fixed links to log files not working with customized outputs path.
4+
15
### 2.0.18 MRE
26

37
* Added support for authentication in --share mode (via auth.json).

webui.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -518,4 +518,5 @@ def stop_clicked():
518518

519519

520520
app = gr.mount_gradio_app(app, shared.gradio_root, '/')
521-
shared.gradio_root.launch(inbrowser=True, server_name=args.listen, server_port=args.port, share=args.share, auth=check_auth if args.share and auth_enabled else None)
521+
shared.gradio_root.launch(inbrowser=True, server_name=args.listen, server_port=args.port, share=args.share,
522+
auth=check_auth if args.share and auth_enabled else None, allowed_paths=[modules.path.temp_outputs_path])

0 commit comments

Comments
 (0)