mirror of
https://github.com/DominikDoom/a1111-sd-webui-tagcomplete.git
synced 2026-11-05 00:17:25 +00:00
[GH-ISSUE #186] ValueError: '/1/tags' is not in the subpath of '/2' OR one path is relative and the other is absolute #132
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
low priority
low priority
pull-request
question
waiting for feedback
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
DominikDoom/a1111-sd-webui-tagcomplete#132
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @TokcDK on GitHub (Jun 10, 2023).
Original GitHub issue: https://github.com/DominikDoom/a1111-sd-webui-tagcomplete/issues/186
Suppose the error happen when --data-dir run parameter of sd is set.
Error itself:
File "", line 883, in exec_module
File "", line 241, in _call_with_frames_removed
File "/content/drive/MyDrive/SD/extensions/a1111-sd-webui-tagcomplete/scripts/tag_autocomplete_helper.py", line 224, in
write_tag_base_path()
File "/content/drive/MyDrive/SD/extensions/a1111-sd-webui-tagcomplete/scripts/tag_autocomplete_helper.py", line 191, in write_tag_base_path
f.write(TAGS_PATH.relative_to(FILE_DIR).as_posix())
File "/usr/lib/python3.10/pathlib.py", line 818, in relative_to
raise ValueError("{!r} is not in the subpath of {!r}"
ValueError: '/content/drive/MyDrive/SD/extensions/a1111-sd-webui-tagcomplete/tags' is not in the subpath of '/content/repository' OR one path is relative and the other is absolute.
run parameters: -u -m launch --data-dir /content/drive/MyDrive/SD --xformers --xformers-flash-attention
@DominikDoom commented on GitHub (Jun 10, 2023):
This is due to a Gradio security feature / issue. The javascript side of the extension (~80% of the functionality) will not be able to access files that are not in the root folder of the webui. And for good reason, as Gradio is a local server that can be shared and thus accessed from outside, if arbitrary client side javascript could access any files on your system, it would be a massive risk.
But due to this, as you said, if the data dir or extensions dir is anywhere outside of the webui root, the script won't work. Sadly nothing I can do about it with the current way this works, it would need manual deactivation of the aforementioned Gradio security features by editing their code.
@DominikDoom commented on GitHub (Jun 15, 2023):
@TokcDK Good news, if still needed:
With the most recent update, the extension can now work with data-dir.
You will need to add the
--gradio-allowed-pathargument to your webui start script to make this work, else the helper will not throw the error anymore, but the server will still return 403 Unauthorized for any extension javascript file or tags file the webui tries to load.A word of caution if you share the webui on your local network or even as a public server:
The allowed path will be publicly exposed. A simple JavaScript
fetch("file=path/to/file")can access any file contents in that directory and its subdirectories, as long as the filename is known. You need to be careful what you allow in there.I suggest only allowing the install dir of tag autocomplete itself for base functionality, or if you use wildcard extensions and want to use the wildcard completion feature, the whole extensions dir at most.
@TokcDK commented on GitHub (Jun 16, 2023):
Ok, understood you. Thanks for the info!