BUG: GET /assets with both status and include_archived=true — archived filter overrides status filter #78

Closed
opened 2026-05-25 06:29:51 -04:00 by zgaetano · 0 comments
Owner

Bug

GET /api/v1/assets at services/mam-api/src/routes/assets.js:36-39:

if (!status && include_archived !== 'true') {
  query += ` AND a.status <> 'archived'`;
}

The archived exclusion only applies when status is NOT set. But if a user passes status=error&include_archived=true, the archived exclusion is skipped (correct), but if they pass just include_archived=true without status, archived assets are included (correct).

BUT: If a user passes status=processing&include_archived=true, the archived filter is skipped because status is truthy. But this also means the query returns ALL non-archived processing assets plus any archived assets. The archived filter only excludes archived when status is not set.

Impact

This is actually correct behavior — if you filter by a specific status, assets with that status will show regardless of archive flag. The only issue is conceptual: the parameter name include_archived suggests it adds archived assets, but it actually just skips the exclusion.

No functional bug — just misleading parameter semantics.

Location

services/mam-api/src/routes/assets.js:36-39

## Bug `GET /api/v1/assets` at `services/mam-api/src/routes/assets.js:36-39`: ```js if (!status && include_archived !== 'true') { query += ` AND a.status <> 'archived'`; } ``` The archived exclusion only applies when `status` is NOT set. But if a user passes `status=error&include_archived=true`, the archived exclusion is skipped (correct), but if they pass just `include_archived=true` without `status`, archived assets are included (correct). **BUT**: If a user passes `status=processing&include_archived=true`, the archived filter is skipped because `status` is truthy. But this also means the query returns ALL non-archived processing assets plus any archived assets. The archived filter only excludes `archived` when `status` is not set. ## Impact This is actually correct behavior — if you filter by a specific status, assets with that status will show regardless of archive flag. The only issue is conceptual: the parameter name `include_archived` suggests it adds archived assets, but it actually just skips the exclusion. No functional bug — just misleading parameter semantics. ## Location `services/mam-api/src/routes/assets.js:36-39`
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: WildDragonLLC/dragonflight#78
No description provided.