lllyasviel / stable-diffusion-webui-forge

GNU Affero General Public License v3.0
7.96k stars 775 forks source link

About the way of set the path to the Javascript/css files. #1992

Open JohnneyTexas opened 1 week ago

JohnneyTexas commented 1 week ago

Currently, the path to the Javascript/css file in the HEAD tag is

or \

However, this causes "File not allowed" and does not work correctly. This problem may be caused by the fact that I am installing on a network drive, but I would really like you to fix this so that it can work correctly.

The OS is Windows for both the terminal used and the remote terminal.

By the way, the same link settings are used for A1111, reForge, and Fooocus, and they work without any problems. And the old Forge also worked without any problems.

This phenomenon is only occurring in New Forge. I feel like there is some kind of bug lurking in the server function generation part, but what do you think?

JohnneyTexas commented 5 days ago

Although it was only a temporary fix, I managed to solve the problem myself by making the following changes. I hope this will be helpful to anyone with the same problem.

webui\modules\ui_gradio_extensions.py def webpath(fn)(change around line 8 as follows)

[Original] def webpath(fn): return f'file={util.truncate_path(fn)}?{os.path.getmtime(fn)}'

[Change(Convert UNC path to local path)] def webpath(fn): if fn.startswith(r'\RemotePC\z'): fn = fn.replace(r'\RemotePC\z', r'Z:') return f'file={util.truncate_path(fn)}?{os.path.getmtime(fn)}'

Note that the OS must be Windows and the remote drive must be bound on the local terminal. This example is for when the remote drive is mounted as the Z drive.