diff --git a/CHANGELOG.md b/CHANGELOG.md index 995919121..cd9910389 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ All notable changes to this project will be documented in this file. ### Enhancements made -- If ServerApp.ip is ipv6 use [::1] as local_url [#1495](https://github.com/jupyter-server/jupyter_server/pull/1495) ([@manics](https://github.com/manics)) +- If ServerApp.ip is ipv6 use \[::1\] as local_url [#1495](https://github.com/jupyter-server/jupyter_server/pull/1495) ([@manics](https://github.com/manics)) - Don't hide .so,.dylib files by default [#1457](https://github.com/jupyter-server/jupyter_server/pull/1457) ([@nokados](https://github.com/nokados)) - Add async start hook to ExtensionApp API [#1417](https://github.com/jupyter-server/jupyter_server/pull/1417) ([@Zsailer](https://github.com/Zsailer)) diff --git a/jupyter_server/serverapp.py b/jupyter_server/serverapp.py index 1c70dd60a..5c84f014c 100644 --- a/jupyter_server/serverapp.py +++ b/jupyter_server/serverapp.py @@ -2359,9 +2359,7 @@ def _get_urlparts( ) return urlparts - @property - def public_url(self) -> str: - parts = self._get_urlparts(include_token=True) + def _customize_url(self, parts: type[urllib.parse.ParseResult]) -> urllib.parse.ParseResult: # Update with custom pieces. if self.custom_display_url: # Parse custom display_url @@ -2370,6 +2368,12 @@ def public_url(self) -> str: custom_updates = {key: item for key, item in custom.items() if item} # Update public URL parts with custom pieces. parts = parts._replace(**custom_updates) + return parts + + @property + def public_url(self) -> str: + parts = self._get_urlparts(include_token=True) + parts = self._customize_url(parts) return parts.geturl() @property @@ -2394,6 +2398,7 @@ def display_url(self) -> str: @property def connection_url(self) -> str: urlparts = self._get_urlparts(path=self.base_url) + urlparts = self._customize_url(urlparts) return urlparts.geturl() def init_signal(self) -> None: