pub1c-web/app/utils.py
2021-10-07 13:39:09 +03:00

10 lines
270 B
Python

from typing import Optional
from flask_restful import abort
from pathvalidate import is_valid_filepath
def validate_url(url: Optional[str]):
if url is not None:
if not is_valid_filepath(url, platform='posix'):
abort(400, message='invalid url')