MCPcopy Index your code
hub / github.com/TaskingAI/TaskingAI / image_url_is_on_localhost

Function image_url_is_on_localhost

plugin/app/service/image_load.py:11–19  ·  view source on GitHub ↗
(url)

Source from the content-addressed store, hash-verified

9from PIL import Image
10
11def image_url_is_on_localhost(url):
12 local_url_identifiers = ['localhost', '0.0.0.0', '127.0.0.1', '::1']
13
14 if any(item in url for item in local_url_identifiers):
15 if "/imgs/" not in url:
16 raise_http_error(ErrorCode.PROVIDER_ERROR, "Invalid local image url.")
17 return True
18
19 return False
20
21async def fetch_image_format(url):
22

Callers 4

construct_image_dataFunction · 0.90
construct_image_dataFunction · 0.90
fetch_image_formatFunction · 0.85
get_image_base64_stringFunction · 0.85

Calls 1

raise_http_errorFunction · 0.90

Tested by

no test coverage detected