Skip to content

[Bug] Capped Git provider error message can end in half a character #853

Done

Description

@dhananjay6561

Summary

providerDetail in services/api/internal/transport/http/handler/git_handler.go caps a provider's validation message with msg[:300], which cuts by bytes. When byte 300 lands inside a multi-byte character the API error ends in half a rune, which shows up as � once the response is JSON-encoded. gitsvc.ProviderMessage already caps its message by runes.

Area

API

Steps to reproduce

  1. Have a Git provider answer a request with a validation or unsupported error whose message is longer than 300 bytes and has a multi-byte character across byte 300 (e.g. a localized message, or one quoting a branch or file name with é, CJK text or an emoji).
  2. Look at the message of the 400 error the API returns ("the platform rejected the request: ...").

Expected behavior

The message is cut at the last whole character before the cap, then ….

Actual behavior

The last character before … is broken and comes out as �.

Activity

  1. pullfrog commented on Dec 3, 2026

    @pullfrog
    Contributor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions