HTTP 500 error using search API for objects with ~ in the name


#1

We have an object with a ~ in it’s name, if you search for that object Nexus responds with a 500 error e.g

curl 'https://username:password@nexus.test.com/service/rest/v1/search?group=&repository=apt&format=raw&name=test/foo~bar' -v

Returns:

> GET /service/rest/v1/search?group=&repository=apt&format=raw&name=test/foo~bar HTTP/2
> Host: nexus.test.com
> User-Agent: curl/7.58.0
> Accept: */*
> 
* Connection state changed (MAX_CONCURRENT_STREAMS updated)!
< HTTP/2 500 
< server: nginx/1.15.2
< date: Wed, 27 Feb 2019 14:50:18 GMT
< content-type: text/plain;charset=utf-8
< content-length: 98
< x-content-type-options: nosniff
< x-siesta-faultid: 5f9e0e84-e77d-46f5-bd1a-3d063864d0bf
< 
* Connection #0 to host nexus.test.com left intact
ERROR: (ID 5f9e0e84-e77d-46f5-bd1a-3d063864d0bf) java.lang.IllegalArgumentException: Invalid query

We are running Nexus 3.15


#2

A tilde is a special character in elasticsearch. Can you try adding a backslash in front of it?


#3

thanks escaping the tilde does work, however a 500 error seems wrong if it is a bad request

or could you possibly handle escaping the tilde in the server during the request?


#4

Yes this seems like a bug to us - a 400 error would probably be more appropriate in this situation.