Skip to content

Commit

Permalink
Update base URL regex to work with paths with 'notebook' in them. (#104)
Browse files Browse the repository at this point in the history
This uses a lazy (non-greedy) regex modifier, to ensure that the first 'notebook' (or 'lab' etc) in the URL is matched
not the last.

Closes #103
  • Loading branch information
robintw authored Dec 10, 2021
1 parent 02db9c5 commit e6b030a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion stackstac/show.py
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ def layers_changed(self, change: dict):
def base_url_from_window_location(url: str) -> Optional[str]:
if not url:
return None
if path_re := re.match(r"(^.+)\/(?:lab|notebook|voila)", url):
if path_re := re.match(r"(^.+?)\/(?:lab|notebook|voila)", url):
return path_re.group(1)
return None

Expand Down

0 comments on commit e6b030a

Please sign in to comment.