Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

调用 publishConfig 会覆盖数据库 type 字段 #3907

Closed
sokeung opened this issue Sep 24, 2020 · 2 comments · Fixed by #3915
Closed

调用 publishConfig 会覆盖数据库 type 字段 #3907

sokeung opened this issue Sep 24, 2020 · 2 comments · Fixed by #3915
Labels
kind/enhancement Category issues or prs related to enhancement.
Milestone

Comments

@sokeung
Copy link

sokeung commented Sep 24, 2020

版本:Spring Boot 2.3.3,Nacos Client 1.3.0,Nacos Server 1.3.2

代码 NacosConfigService 类 publishConfigInner 第 252 行 result = agent.httpPost(url, headers, params, encode, POST_TIMEOUT);

params 参数如下:

image

缺少 type 参数,请求后会覆盖数据库原本的 type,导致 type 为 null。

Nacos 控制台:

image

以下是官方接口参数:

image

直接调用接口,忽略 type 参数和上面的结果相同。

image

@horizonzy
Copy link
Collaborator

horizonzy commented Oct 14, 2020

现在有几种情况可能会导致为空.
1.通过openApi发布配置不传type
2.在控制台发布配置也不传type
3.sdk客户端现在没有支持type赋值,发布也是为空

针对以上这几种情况。如果没有传,当成text处理。text所有情况能都覆盖,因为content就是一堆字符串。如果传了,那用户传的是什么,就是什么。(需不需要对用户传的type做校验,这点待定)

@horizonzy
Copy link
Collaborator

现在有几种情况可能会导致为空.
1.通过openApi发布配置不传type
2.在控制台发布配置也不传type
3.sdk客户端现在没有支持type赋值,发布也是为空

针对以上这几种情况。如果没有传,当成text处理。text所有情况能都覆盖,因为content就是一堆字符串。如果传了,那用户传的是什么,就是什么。(需不需要对用户传的type做校验,这点待定)

@chuntaojun 春少看一下这个方案呢

ChasingInTheWind added a commit to ChasingInTheWind/nacos that referenced this issue Oct 30, 2020
…is no suffix or unsupported suffix, use the text as the default value(alibaba#3907)
KomachiSion pushed a commit that referenced this issue Nov 9, 2020
…e 'text' (#3915)

* when publishConfig, if type is absent, set default value 'text'

* 1.add publishConfig api(add param type)
2.check type is valid in nacos server
@KomachiSion KomachiSion added this to the 1.4.1 milestone Nov 9, 2020
@KomachiSion KomachiSion modified the milestones: 1.4.1, 1.4.2 Jan 13, 2021
@KomachiSion KomachiSion modified the milestones: 1.4.2, 1.4.3 Apr 29, 2021
@realJackSun realJackSun modified the milestones: 1.4.3, 1.4.4 Jan 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment