[Bug] got confused by passing "documentid" parameters to the kernelmemory/service #587
pangjianxin
started this conversation in
Misc
Replies: 1 comment
-
The document id can only have chars in the allowed set: A-B, a-b, 0-9, '.', '_', '-', which means characters like space ' ', percentage '%' etc are not supported. The value of WebUtility.UrlEncode("我的信息") is "%E6%88%91%E7%9A%84%E4%BF%A1%E6%81%AF" which contains '%' char and it is not allowed in the format of a proper document id used by KernelMemory. You could do WebUtility.UrlEncode("我的信息").Replace("%", String.Empty) but I would strongly suggest to use a simple English phrase instead. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Context / Scenario
i run the kernel memory service as a docker container.
and then i pass parameters to the MemoryWebClient's ImportDocumentAsync method.this method needs a argument named 'documentId'.
what i passed the documentId parameter to ImportDocumentAsync was like "我的信息",and then a exception thrown by kernel-memory-service docker container,it was like :
Connection id "0HN2IN79NC1ES", Request id "0HN2IN79NC1ES:00000001": An unhandled exception was thrown by the application. System.InvalidOperationException: Invalid non-ASCII or control character in header: 0x6211 at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpHeaders.ThrowInvalidHeaderCharacter(Char ch) at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpHeaders.ValidateHeaderValueCharacters(String headerCharacters, Boolean requireAscii) at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpHeaders.ValidateHeaderValueCharacters(String headerName, StringValues headerValues, Func
2 encodingSelector)at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpResponseHeaders.Microsoft.AspNetCore.Http.IHeaderDictionary.set_Location(StringValues value)
at Microsoft.AspNetCore.Http.HttpResults.Accepted
1.ExecuteAsync(HttpContext httpContext) at Microsoft.AspNetCore.Http.RequestDelegateFactory.ExecuteResultWriteResponse(IResult result, HttpContext httpContext) at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger) at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext) at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider) at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication
1 application)`
the exception was obvious that i tried transform the "docuementId " parameter by the WebUtility.UrlEncode() method ,but now ,i get another exception:
The document ID contains invalid chars (allowed: A-B, a-b, 0-9, '.', '_', '-') (Parameter 'id')
could you help me?
What happened?
why the documentid must be transported by http-header?
Importance
edge case
Platform, Language, Versions
win11,C#8
Relevant log output
No response
Beta Was this translation helpful? Give feedback.
All reactions