Project

General

Profile

Actions

Defect #34615

closed

'Search' falsy parameters are not respected

Added by Jakub G almost 4 years ago. Updated almost 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
REST API
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

I'd like to implement search feature using REST API, but i noticed that this feature do not respect passed falsy values (booleans nor numbers). The same behavior can be observed on page.

What i mean is that if i pass 'false' or '0' as value, it's treated like truthy value anyway.

For example, logically, this query:

https://www.redmine.org/projects/redmine/search?q=issue&issues=0&news=0&changesets=0&wiki_pages=1&messages=false&redmine_plugins=0

should return results of only wiki pages with word 'issue' (because for other parameters i passed falsy values: '0' or 'false'). But those values are ignored. Even when i pass empty parameter (like '...&messages=&...') it's stil not working properly.

Why is it so big deal?

Well, since on page there is dedicated form for searching, it's not a problem, but when i'm using API eg. in Node.js, it's more logical and convinient way to pass all search parameters but with bool values (or eventually empty when use 'null' or 'undefined' JS type).

P.S.: Tested on Redmine version 4.1.1


Files

Actions

Also available in: Atom PDF