apache / gravitino

World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.
https://gravitino.apache.org
Apache License 2.0
1.1k stars 345 forks source link

[Bug report]It's better to handle the property vaule include Illegal character #1461

Closed danhuawang closed 7 months ago

danhuawang commented 10 months ago

Describe what's wrong

set a property value as "us-east-1a,\n\t\t\tus-east-1b,\n\t\t\tus-east-1c" in the metalake

Error message and/or stacktrace

Illegal unquoted character ((CTRL-CHAR, code 10)): has to be escaped using backslash to be included in string value at [Source: (org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream); line: 6, column: 32] (through reference chain: com.datastrato.gravitino.dto.requests.MetalakeUpdatesRequest["updates"]->java.util.ArrayList[0]->com.datastrato.gravitino.dto.requests.MetalakeUpdateRequest$SetMetalakePropertyRequest["value"])
--

How to reproduce

set a property value as "us-east-1a,\n\t\t\tus-east-1b,\n\t\t\tus-east-1c" in the metalake

Additional context

No response

yuqi1129 commented 10 months ago

@danhuawang Hi, can you provide more details about how to reproduce it, I can't reproduce it locally.

➜  [/Users/yuqi] curl -X PUT -H "Accept: application/vnd.gravitino.v1+json" \
-H "Content-Type: application/json" -d '{
  "updates": [
    {
      "@type": "setProperty",
      "property": "key2",
      "value": "us-east-1a,\n\t\t\tus-east-1b,\n\t\t\tus-east-1c"
    }
  ]
}' http://localhost:8090/api/metalakes/test1

{"code":0,"metalake":{"name":"test1","comment":"comment","properties":{"a":"b,c,d","key2":"us-east-1a,\n\t\t\tus-east-1b,\n\t\t\tus-east-1c"},"audit":{"creator":"anonymous","createTime":"2024-01-12T08:42:44.006426Z","lastModifier":"anonymous","lastModifiedTime":"2024-01-12T08:45:39.814405Z"}}}%
danhuawang commented 10 months ago

@yuqi1129 try to use the requestbody as below:

{ "updates": [ { "@type": "setProperty", "property": "zone", "value": "us-east-1a, us-east-1b, us-east-1c"
}
] }

yuqi1129 commented 10 months ago

@yuqi1129 try to use the requestbody as below:

{ "updates": [ { "@type": "setProperty", "property": "zone", "value": "us-east-1a, us-east-1b, us-east-1c" } ] }

I doubt whether

      "value": "us-east-1a,
      us-east-1b,
      us-east-1c"

is a valid string value.

yuqi1129 commented 7 months ago

@danhuawang

image

It's not a valid JSON string, please take a look.

yuqi1129 commented 7 months ago

Close it as it's not an issue.