Ask a secure retriever whether a field is open beside its items
A secure retriever's values are at .../{parameter}/items and its
questions - is the field required, does it take a typed value - at
.../{parameter}/required and /open beside them. The question URL was
made by suffixing the values URL, so for every secure retriever it
pointed under items, where nothing answers: choosing a global input as
a file's source showed an error contacting the server.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
f2ade91000
commit
da269130f6
|
|
@ -26,4 +26,10 @@ describe('appendRetrieverQuestion', () => {
|
|||
expect(appendRetrieverQuestion(undefined, 'open')).toBeNull();
|
||||
expect(appendRetrieverQuestion(' ', 'open')).toBeNull();
|
||||
});
|
||||
it('asks a secure retriever beside its items, not under them', () => {
|
||||
expect(appendRetrieverQuestion('/secure-retriever/GlobalInputs/inputs/items?type=FILE', 'open'))
|
||||
.toBe('/secure-retriever/GlobalInputs/inputs/open?type=FILE');
|
||||
expect(appendRetrieverQuestion('/secure-retriever/Flows/subFlow/items', 'required'))
|
||||
.toBe('/secure-retriever/Flows/subFlow/required');
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -17,7 +17,10 @@ export function appendRetrieverQuestion(
|
|||
question: RetrieverQuestion
|
||||
): string | null {
|
||||
if (typeof rawUrl !== 'string' || rawUrl.trim().length === 0) return null;
|
||||
const [path, queryString] = rawUrl.split('?', 2);
|
||||
const [rawPath, queryString] = rawUrl.split('?', 2);
|
||||
// A secure retriever's values live at `.../{parameter}/items`, its questions at
|
||||
// `.../{parameter}/{question}` beside them - not under `items`, where nothing answers.
|
||||
const path = rawPath.replace(/\/items$/, '');
|
||||
const normalizedPath = path.endsWith(`/${question}`) ? path : `${path}/${question}`;
|
||||
return queryString ? `${normalizedPath}?${queryString}` : normalizedPath;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue