Skip to content

Commit f39556b

Browse files
authored
Merge pull request open-webui#11163 from tidely/pathfix
chore: Use platform specific path separators
2 parents cffd02d + b15814c commit f39556b

File tree

7 files changed

+10
-10
lines changed

7 files changed

+10
-10
lines changed

backend/open_webui/config.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -699,16 +699,16 @@ def oidc_oauth_register(client):
699699
# File Upload DIR
700700
####################################
701701

702-
UPLOAD_DIR = f"{DATA_DIR}/uploads"
703-
Path(UPLOAD_DIR).mkdir(parents=True, exist_ok=True)
702+
UPLOAD_DIR = DATA_DIR / "uploads"
703+
UPLOAD_DIR.mkdir(parents=True, exist_ok=True)
704704

705705

706706
####################################
707707
# Cache DIR
708708
####################################
709709

710-
CACHE_DIR = f"{DATA_DIR}/cache"
711-
Path(CACHE_DIR).mkdir(parents=True, exist_ok=True)
710+
CACHE_DIR = DATA_DIR / "cache"
711+
CACHE_DIR.mkdir(parents=True, exist_ok=True)
712712

713713

714714
####################################

backend/open_webui/routers/audio.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
log = logging.getLogger(__name__)
5555
log.setLevel(SRC_LOG_LEVELS["AUDIO"])
5656

57-
SPEECH_CACHE_DIR = Path(CACHE_DIR).joinpath("./audio/speech/")
57+
SPEECH_CACHE_DIR = CACHE_DIR / "audio" / "speech"
5858
SPEECH_CACHE_DIR.mkdir(parents=True, exist_ok=True)
5959

6060

backend/open_webui/routers/functions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ async def create_new_function(
7474

7575
function = Functions.insert_new_function(user.id, function_type, form_data)
7676

77-
function_cache_dir = Path(CACHE_DIR) / "functions" / form_data.id
77+
function_cache_dir = CACHE_DIR / "functions" / form_data.id
7878
function_cache_dir.mkdir(parents=True, exist_ok=True)
7979

8080
if function:

backend/open_webui/routers/images.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
log = logging.getLogger(__name__)
2626
log.setLevel(SRC_LOG_LEVELS["IMAGES"])
2727

28-
IMAGE_CACHE_DIR = Path(CACHE_DIR).joinpath("./image/generations/")
28+
IMAGE_CACHE_DIR = CACHE_DIR / "image" / "generations"
2929
IMAGE_CACHE_DIR.mkdir(parents=True, exist_ok=True)
3030

3131

backend/open_webui/routers/openai.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ async def speech(request: Request, user=Depends(get_verified_user)):
192192
body = await request.body()
193193
name = hashlib.sha256(body).hexdigest()
194194

195-
SPEECH_CACHE_DIR = Path(CACHE_DIR).joinpath("./audio/speech/")
195+
SPEECH_CACHE_DIR = CACHE_DIR / "audio" / "speech"
196196
SPEECH_CACHE_DIR.mkdir(parents=True, exist_ok=True)
197197
file_path = SPEECH_CACHE_DIR.joinpath(f"{name}.mp3")
198198
file_body_path = SPEECH_CACHE_DIR.joinpath(f"{name}.json")

backend/open_webui/routers/tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ async def create_new_tools(
105105
specs = get_tools_specs(TOOLS[form_data.id])
106106
tools = Tools.insert_new_tool(user.id, form_data, specs)
107107

108-
tool_cache_dir = Path(CACHE_DIR) / "tools" / form_data.id
108+
tool_cache_dir = CACHE_DIR / "tools" / form_data.id
109109
tool_cache_dir.mkdir(parents=True, exist_ok=True)
110110

111111
if tools:

backend/open_webui/utils/pdf_generator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def generate_chat_pdf(self) -> bytes:
110110
# When running using `pip install -e .` the static directory is in the site packages.
111111
# This path only works if `open-webui serve` is run from the root of this project.
112112
if not FONTS_DIR.exists():
113-
FONTS_DIR = Path("./backend/static/fonts")
113+
FONTS_DIR = Path(".") / "backend" / "static" / "fonts"
114114

115115
pdf.add_font("NotoSans", "", f"{FONTS_DIR}/NotoSans-Regular.ttf")
116116
pdf.add_font("NotoSans", "b", f"{FONTS_DIR}/NotoSans-Bold.ttf")

0 commit comments

Comments
 (0)