Skip to content

Commit

Permalink
fix(list): ensure the recursive option is set
Browse files Browse the repository at this point in the history
The recursive variable bound to the query was undefined when both
the tree and the recursive option were not set.
Since these are conflicting, they cannot be assigned a default value.
  • Loading branch information
line-o committed Oct 3, 2023
1 parent 0b00dbe commit 61ac91c
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions commands/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -433,15 +433,17 @@ function getListRenderer (options, renderItem, sortItemList) {
*/
async function ls (db, collection, options) {
const { glob, long, tree, recursive, depth } = options
const result = await db.queries.readAll(query, {
variables: {
collection,
glob,
depth,
recursive: tree || recursive,
'collections-only': options['collections-only']
}
})
const variables = {
collection,
glob,
depth,
recursive: Boolean(tree || recursive),
'collections-only': options['collections-only']
}
if (options.debug) {
console.log(variables)
}
const result = await db.queries.readAll(query, { variables })
const raw = result.pages.toString()
const json = JSON.parse(raw)
if (json.error) {
Expand Down

0 comments on commit 61ac91c

Please sign in to comment.