mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-09-22 03:20:03 +00:00
15 lines
336 B
Python
15 lines
336 B
Python
"""Validations"""
|
|
from typing import Optional
|
|
|
|
from bookwyrm.settings import BASE_URL
|
|
|
|
|
|
def validate_url_domain(url: Optional[str]) -> Optional[str]:
|
|
"""Basic check that the URL starts with the instance domain name"""
|
|
if url is None:
|
|
return None
|
|
|
|
if not url.startswith(BASE_URL):
|
|
return None
|
|
|
|
return url
|