Skip to content

Python: Make media type detection documentation examples runnable - #9188

Open
BlueRaddish wants to merge 1 commit into
microsoft:mainfrom
BlueRaddish:docs/oct7-media-detection-examples
Open

BlueRaddish wants to merge 1 commit into
microsoft:mainfrom
BlueRaddish:docs/oct7-media-detection-examples

Conversation

@BlueRaddish

Copy link
Copy Markdown
Contributor

Motivation & Context

Both detect_media_type_from_base64 documentation examples use a truncated base64 string containing .... Copying either example raises ValueError: Invalid base64 data provided. instead of returning the documented image/png result.

Description & Review Guide

  • What are the major changes? Replace the truncated payloads with the valid base64-encoded PNG signature and describe that signature in the comment.
  • What is the impact of these changes? Both examples execute successfully. Runtime behavior and public APIs remain unchanged.
  • What do you want reviewers to focus on? The payload represents the PNG signature bytes used by this magic-byte detector, rather than a complete image file. Both examples were extracted from the actual docstring and executed offline against the selected checkout: two ValueError failures before the change, two image/png results after it. Scoped Ruff lint and formatting checks and all normal scoped prek hooks also pass, with the reviewed diff unchanged. Prepared with assistance from OpenAI Codex.

Related Issue

Fixes #9187

Contribution Checklist

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible
  • The PR follows the Contribution Guidelines
  • This PR is linked to an issue and there is no other open PR for this issue (see Related Issue above).
  • This is not a breaking change.

@BlueRaddish
BlueRaddish deployed to github-app-auth October 8, 2026 00:32 — with GitHub Actions Active
Copilot AI balanced review requested due to automatic review settings October 8, 2026 00:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@eavanvalkenburg

Copy link
Copy Markdown
Member

/review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MAF Automated Review — Iteration 1

Result: No findings
Scope: full PR (1 commit(s)): d32a23a7afc4
Model: gpt-5.6-sol

Overview

This documentation-only change replaces two invalid truncated Base64 examples with the complete encoding of the PNG signature. The corrected string passes strict Base64 decoding, exercises both the direct-string and data-URI paths, and matches the implementation's PNG magic-byte check without changing runtime or public API behavior. No publishable risk was established.

Reviewed the supplied pull-request change set across correctness, security/reliability, architecture, and failure behavior.
No publishable findings remained after source verification for this scope.

This branch was successfully deployed

1 active deployment
github-app-auth — d32a23a7 Deployed Oct 8, 2026 by BlueRaddish via team_check #6324
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Usage: [Issues, PRs], Target: Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python: [Bug]: Media type detection documentation examples contain invalid base64

3 participants