From 47b53c03cd9ad3139b193ca9b9f741d6f27a2c3b Mon Sep 17 00:00:00 2001
From: Simon Li <orpheus+devel@gmail.com>
Date: Sun, 26 Jan 2025 13:32:31 +0000
Subject: [PATCH] display_url: Don't duplicate public_url and local_url if they
 are the same

---
 jupyter_server/serverapp.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/jupyter_server/serverapp.py b/jupyter_server/serverapp.py
index 8aa3dbd082..9171065132 100644
--- a/jupyter_server/serverapp.py
+++ b/jupyter_server/serverapp.py
@@ -2385,7 +2385,9 @@ def display_url(self) -> str:
         """Human readable string with URLs for interacting
         with the running Jupyter Server
         """
-        url = self.public_url + "\n    " + self.local_url
+        url = self.public_url
+        if self.public_url != self.local_url:
+            url = f"{url}\n    {self.local_url}"
         return url
 
     @property