MCPcopy Create free account
hub / github.com/crisxuan/bestJavaer / image_issue

Function image_issue

scripts/check_article_quality.py:345–366  ·  view source on GitHub ↗
(article_path: Path, ref: ImageRef, *, staged: bool, args: argparse.Namespace, root: Path)

Source from the content-addressed store, hash-verified

343
344
345def image_issue(article_path: Path, ref: ImageRef, *, staged: bool, args: argparse.Namespace, root: Path) -> str | None:
346 target = ref.target.strip()
347 if not target:
348 return "image target is empty"
349
350 lower_target = target.lower()
351 if lower_target.startswith("data:image/"):
352 return None
353 if lower_target.startswith("data:"):
354 return "data URI is not an image"
355 if target.startswith("//"):
356 if not args.check_remote_images:
357 return None
358 return remote_image_issue(f"https:{target}", args.remote_image_timeout)
359
360 split = urlsplit(target)
361 if split.scheme in {"http", "https"}:
362 if not args.check_remote_images:
363 return None
364 return remote_image_issue(target, args.remote_image_timeout)
365
366 return local_image_issue(article_path, target, staged=staged, root=root)
367
368
369def check_images(

Callers 1

check_imagesFunction · 0.85

Calls 2

remote_image_issueFunction · 0.85
local_image_issueFunction · 0.85

Tested by

no test coverage detected