pub1c-web/app/utils.py

10 lines
270 B
Python
Raw Normal View History

2021-10-07 10:39:09 +00:00
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')