Skip to content

Commit

Permalink
Fix the bug with value parameter being overriden by newly introduced q
Browse files Browse the repository at this point in the history
  • Loading branch information
MunGell committed Jun 15, 2024
1 parent d8583e3 commit debc3ea
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/ZoteroAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { ZoteroItem } from './ZoteroItem';
import { ZoteroBridgeConnectionType } from './ZoteroBridgeSettings'

type ZoteroItemsRequestParameters = {
condition?: string, // ZotServer-specific parameter, to be deprecated in future
itemType?: string,
tag?: string,
format?: string,
Expand Down Expand Up @@ -77,7 +76,6 @@ export class ZotServerAdapter implements ZoteroAdapter {

search(query: string) {
return this.items({
condition: 'quicksearch-titleCreatorYear',
q: query
})
}
Expand All @@ -87,7 +85,10 @@ export class ZotServerAdapter implements ZoteroAdapter {
url: `${this.baseUrl}/search`,
method: 'post',
contentType: 'application/json',
body: JSON.stringify(parameters)
body: JSON.stringify({
condition: 'quicksearch-titleCreatorYear',
value: parameters.q
})
})
.then(JSON.parse)
.then((items: any[]) => items.filter(item => !['attachment', 'note'].includes(item.itemType)).map(item => new ZoteroItem(item)))
Expand Down

0 comments on commit debc3ea

Please sign in to comment.