From 95348dd1de48570bb1c3c1da275b458401f42cb8 Mon Sep 17 00:00:00 2001 From: Laura Merlo Date: Sat, 20 Jun 2020 17:27:59 +0200 Subject: [PATCH] FIX: removed double link when custom_display_url (#5400) --- notebook/notebookapp.py | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/notebook/notebookapp.py b/notebook/notebookapp.py index b907c112b8..2b82439595 100755 --- a/notebook/notebookapp.py +++ b/notebook/notebookapp.py @@ -1777,7 +1777,8 @@ def display_url(self): url = self._tcp_url(ip) if self.token and not self.sock: url = self._concat_token(url) - url += '\n or %s' % self._concat_token(self._tcp_url('127.0.0.1')) + if not self.custom_display_url: + url += '\n or %s' % self._concat_token(self._tcp_url('127.0.0.1')) return url @property @@ -2216,13 +2217,22 @@ def start(self): ) % (self.sock, self._concat_token(self._tcp_url('localhost', 8888))) ])) else: - self.log.critical('\n'.join([ - '\n', - 'To access the notebook, open this file in a browser:', - ' %s' % urljoin('file:', pathname2url(self.browser_open_file)), - 'Or copy and paste one of these URLs:', - ' %s' % self.display_url, - ])) + if not self.custom_display_url: + self.log.critical('\n'.join([ + '\n', + 'To access the notebook, open this file in a browser:', + ' %s' % urljoin('file:', pathname2url(self.browser_open_file)), + 'Or copy and paste one of these URLs:', + ' %s' % self.display_url, + ])) + else: + self.log.critical('\n'.join([ + '\n', + 'To access the notebook, open this file in a browser:', + ' %s' % urljoin('file:', pathname2url(self.browser_open_file)), + 'Or copy and paste this URL:', + ' %s' % self.display_url, + ])) self.io_loop = ioloop.IOLoop.current() if sys.platform.startswith('win'):