Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

fix: accept single-digit ports in is_url (#11410)

ANO3457774844f9f981
diff --git a/marimo/_utils/url.py b/marimo/_utils/url.py
index abc937fda7..495a164045 100644
--- a/marimo/_utils/url.py
+++ b/marimo/_utils/url.py
@@ -82,7 +82,7 @@ regex = re.compile(
r"[a-z\u00a1-\uffff\U00010000-\U0010ffff]{2,}))"
r")"
# port number
- r"(?::\d{2,5})?"
+ r"(?::\d{1,5})?"
# resource path
r"(?:/[-a-z\u00a1-\uffff\U00010000-\U0010ffff0-9._~%!$&'()*+,;=:@/]*)?"
# query string
diff --git a/tests/_utils/test_url.py b/tests/_utils/test_url.py
new file mode 100644
index 0000000000..ef4aa111d7
--- /dev/null
+++ b/tests/_utils/test_url.py
@@ -0,0 +1,19 @@
+# Copyright 2026 Marimo. All rights reserved.
+from __future__ import annotations
+
+import pytest
+
+from marimo._utils.url import is_url
+
+
+ "url",
+ [
+ "http://127.0.0.1:8/macros.tex",
+ "http://127.0.0.1:80/macros.tex",
+ "http://127.0.0.1:8000/macros.tex",
+ "http://127.0.0.1:65535/macros.tex",
+ ],
+)
+def test_is_url_accepts_valid_ports(url: str) -> None:
+ assert is_url(url)