Skip to content
Snippets Groups Projects
Unverified Commit f6fe7dc3 authored by Agate's avatar Agate 💬
Browse files

Support URL in form protocol

parent 1c10dccb
No related branches found
No related tags found
No related merge requests found
...@@ -26,6 +26,7 @@ domain_filters = { ...@@ -26,6 +26,7 @@ domain_filters = {
def validate_domain(raw): def validate_domain(raw):
raw = raw.split('://')[-1]
if not raw: if not raw:
raise ValueError() raise ValueError()
......
...@@ -2,6 +2,7 @@ import datetime ...@@ -2,6 +2,7 @@ import datetime
import pytest import pytest
from funkwhale_network import db from funkwhale_network import db
from funkwhale_network import routes
from funkwhale_network import serializers from funkwhale_network import serializers
...@@ -129,3 +130,12 @@ async def test_domains_rss(db_conn, factories, client, mocker): ...@@ -129,3 +130,12 @@ async def test_domains_rss(db_conn, factories, client, mocker):
assert resp.status == 200 assert resp.status == 200
assert await resp.text() == expected assert await resp.text() == expected
assert resp.headers["content-type"] == "application/rss+xml" assert resp.headers["content-type"] == "application/rss+xml"
@pytest.mark.parametrize('input,expected', [
('example.com', 'example.com'),
('http://example.com', 'example.com'),
('https://example.com', 'example.com'),
])
def test_validate_domain(input, expected):
assert routes.validate_domain(input) == expected
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment