Skip to content

Commit 8cb0497

Browse files
committed
🐛 properly encode socket uri
1 parent 39e703d commit 8cb0497

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

vue_ssr/vue_ssr.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
from abc import ABC, abstractmethod
22
from functools import cached_property
3+
from os import PathLike
34
from typing import Any, Optional
5+
from urllib.parse import quote
46

57
import requests
68
import requests_unixsocket
@@ -74,16 +76,16 @@ def render(
7476
class SocketServerRenderer(ServerRenderer):
7577
"""Connect to a vue-ssr-service server via a UNIX socket."""
7678

77-
def __init__(self, socket: str):
79+
def __init__(self, socket: PathLike | str):
7880
"""
7981
:param socket: The path to the Unix socket.
8082
"""
81-
self.unix_socket = socket
83+
self.unix_socket = str(socket)
8284
self._session = requests_unixsocket.Session()
8385

8486
@cached_property
8587
def address(self) -> str:
86-
return f"http+unix://{self.unix_socket}"
88+
return f"http+unix://{quote(self.unix_socket, safe='')}"
8789

8890

8991
class ViteRenderer(SSRRenderer):

0 commit comments

Comments
 (0)