Skip to content

fix: use exact token matching in checkDataStore instead of substring search - #117

Open
SoundMatt wants to merge 1 commit into
COVESA:mainfrom
SoundMatt:fix/rdfox-datastore-exact-match
Open

fix: use exact token matching in checkDataStore instead of substring search#117
SoundMatt wants to merge 1 commit into
COVESA:mainfrom
SoundMatt:fix/rdfox-datastore-exact-match

Conversation

@SoundMatt

Copy link
Copy Markdown

Problem

checkDataStore() uses response_body.find(data_store_) != std::string::npos, which is a substring search. A store named "ds" falsely matches "ds-extended", and a short name like "e" would match the CSV column header "datastore", causing the adapter to report that a store exists when it does not (or vice versa with a name that is a prefix of another).

Root cause

The /datastores endpoint returns a single-column CSV (header: datastore, rows: store names). Using find on the raw body does not respect token boundaries, so any name that is a substring of another token in the response produces a false positive.

Fix

Replace find with whitespace-tokenised iteration (std::istringstream >> token) and compare each token exactly against data_store_. This handles both space-separated and newline-separated responses. Add <sstream> to the includes.

…search

checkDataStore used response_body.find(data_store_) which is a substring
search. A store named 'ds' would match 'ds-extended', and a store named
'e' would match the CSV column header 'datastore'. Parse the response
body into whitespace-separated tokens and compare each one exactly
against data_store_. Add <sstream> which is needed for std::istringstream.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Signed-off-by: Matt Jones <47545907+SoundMatt@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant