v1-0001-Fix-some-untranslatable-error-messages-in-OAuth.patch
application/octet-stream
Filename: v1-0001-Fix-some-untranslatable-error-messages-in-OAuth.patch
Type: application/octet-stream
Part: 0
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: format-patch
Series: patch v1-0001
Subject: Fix some untranslatable error messages in OAuth
| File | + | − |
|---|---|---|
| src/interfaces/libpq-oauth/oauth-curl.c | 14 | 14 |
From 17918342432a15285dc35b24d2c9e080b9d0b818 Mon Sep 17 00:00:00 2001
From: Zhijie Hou <houzj.fnst@fujitsu.com>
Date: Thu, 13 Nov 2025 13:32:02 +0800
Subject: [PATCH v1] Fix some untranslatable error messages in OAuth
---
src/interfaces/libpq-oauth/oauth-curl.c | 28 ++++++++++++-------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/src/interfaces/libpq-oauth/oauth-curl.c b/src/interfaces/libpq-oauth/oauth-curl.c
index 08e300715da..515f4d9b4eb 100644
--- a/src/interfaces/libpq-oauth/oauth-curl.c
+++ b/src/interfaces/libpq-oauth/oauth-curl.c
@@ -475,20 +475,20 @@ report_type_mismatch(struct oauth_parse *ctx)
switch (ctx->active->type)
{
case JSON_TOKEN_STRING:
- msgfmt = "field \"%s\" must be a string";
+ msgfmt = libpq_gettext("field \"%s\" must be a string");
break;
case JSON_TOKEN_NUMBER:
- msgfmt = "field \"%s\" must be a number";
+ msgfmt = libpq_gettext("field \"%s\" must be a number");
break;
case JSON_TOKEN_ARRAY_START:
- msgfmt = "field \"%s\" must be an array of strings";
+ msgfmt = libpq_gettext("field \"%s\" must be an array of strings");
break;
default:
Assert(false);
- msgfmt = "field \"%s\" has unexpected type";
+ msgfmt = libpq_gettext("field \"%s\" has unexpected type");
}
oauth_parse_set_error(ctx, msgfmt, ctx->active->name);
@@ -1087,7 +1087,7 @@ parse_token_error(struct async_ctx *actx, struct token_error *err)
* override the errctx if parsing explicitly fails.
*/
if (!result)
- actx->errctx = "failed to parse token error response";
+ actx->errctx = libpq_gettext("failed to parse token error response");
return result;
}
@@ -2153,7 +2153,7 @@ finish_discovery(struct async_ctx *actx)
/*
* Pull the fields we care about from the document.
*/
- actx->errctx = "failed to parse OpenID discovery document";
+ actx->errctx = libpq_gettext("failed to parse OpenID discovery document");
if (!parse_provider(actx, &actx->provider))
return false; /* error message already set */
@@ -2421,7 +2421,7 @@ finish_device_authz(struct async_ctx *actx)
*/
if (response_code == 200)
{
- actx->errctx = "failed to parse device authorization";
+ actx->errctx = libpq_gettext("failed to parse device authorization");
if (!parse_device_authz(actx, &actx->authz))
return false; /* error message already set */
@@ -2509,7 +2509,7 @@ finish_token_request(struct async_ctx *actx, struct token *tok)
*/
if (response_code == 200)
{
- actx->errctx = "failed to parse access token response";
+ actx->errctx = libpq_gettext("failed to parse access token response");
if (!parse_access_token(actx, tok))
return false; /* error message already set */
@@ -2888,7 +2888,7 @@ pg_fe_run_oauth_flow_impl(PGconn *conn)
switch (actx->step)
{
case OAUTH_STEP_INIT:
- actx->errctx = "failed to fetch OpenID discovery document";
+ actx->errctx = libpq_gettext("failed to fetch OpenID discovery document");
if (!start_discovery(actx, conn_oauth_discovery_uri(conn)))
goto error_return;
@@ -2902,11 +2902,11 @@ pg_fe_run_oauth_flow_impl(PGconn *conn)
if (!check_issuer(actx, conn))
goto error_return;
- actx->errctx = "cannot run OAuth device authorization";
+ actx->errctx = libpq_gettext("cannot run OAuth device authorization");
if (!check_for_device_flow(actx))
goto error_return;
- actx->errctx = "failed to obtain device authorization";
+ actx->errctx = libpq_gettext("failed to obtain device authorization");
if (!start_device_authz(actx, conn))
goto error_return;
@@ -2917,7 +2917,7 @@ pg_fe_run_oauth_flow_impl(PGconn *conn)
if (!finish_device_authz(actx))
goto error_return;
- actx->errctx = "failed to obtain access token";
+ actx->errctx = libpq_gettext("failed to obtain access token");
if (!start_token_request(actx, conn))
goto error_return;
@@ -2968,7 +2968,7 @@ pg_fe_run_oauth_flow_impl(PGconn *conn)
break;
case OAUTH_STEP_WAIT_INTERVAL:
- actx->errctx = "failed to obtain access token";
+ actx->errctx = libpq_gettext("failed to obtain access token");
if (!start_token_request(actx, conn))
goto error_return;
@@ -2994,7 +2994,7 @@ error_return:
* also the documentation for struct async_ctx.
*/
if (actx->errctx)
- appendPQExpBuffer(errbuf, "%s: ", libpq_gettext(actx->errctx));
+ appendPQExpBuffer(errbuf, "%s: ", actx->errctx);
if (PQExpBufferDataBroken(actx->errbuf))
appendPQExpBufferStr(errbuf, libpq_gettext("out of memory"));
--
2.51.1.windows.1