Bug 16014 - Elasticsearch is queried with duplicate slash when share path has a trailing slash
Summary: Elasticsearch is queried with duplicate slash when share path has a trailing ...
Status: NEW
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: File services (show other bugs)
Version: 4.22.6
Hardware: All Linux
: P5 normal (vote)
Target Milestone: ---
Assignee: Samba QA Contact
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2026-02-28 12:08 UTC by mostpinkest
Modified: 2026-03-04 20:48 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description mostpinkest 2026-02-28 12:08:56 UTC
When Elsaticsearch is configured as a spotlight backend and a share is defined with a path which contains a trailing slash (such as:)

```
[Files]
path = /pool/Files/
```

Elastic search gets queried with a path containing duplicate training slashes, producing no results. An example logged query:

```
{
  "from": 0,
  "size": 50,
  "query": {
    "bool": {
      "must": [
        ...
      ],
      "filter": [
        {
          "prefix": {
            "path.real": {
              "value": "/pool/Files//",
              "boost": 1
            }
          }
        }
      ],
      "boost": 1
    }
  },
  "_source": {
    ...
  }
}
```

While a user could remove the slash from the path, Samba's documentation does not dictate whether or not the path should have a trailing slash. As well, in many solutions where a user does not directly interface with Samba, it may not be possible to remove the offending slash.

Samba should tolerate either including or excluding the slash. The path included in the Elasticsearch query should continue to have a single training slash regardless of path format to ensure results are properly filtered.

The additional slash is currently hardcoded here https://gitlab.com/samba-team/samba/-/blob/83f4b51175cdaa20039de7e823bc4c6a15893628/source3/rpc_server/mdssvc/mdssvc_es.c#L48