Commit b09bd9e
authored
fix: preserve asset subfolder in the assets lightbox (#14689)
## Summary
Inspecting a video saved under a subfolder shows an empty player,
because the assets lightbox builds its media URL from a subfolder the
sidebar discarded.
## Changes
- **What**: `AssetsSidebarTab` built every gallery `ResultItemImpl` with
`subfolder: ''` and overrode only the `url` getter. Images resolve
through `preview_url` and were unaffected; `ResultVideo` uses
`vhsAdvancedPreviewUrl`, which is rebuilt from `urlParams` — i.e. from
the discarded subfolder. Extracted `getAssetSubfolder` (reads
`preview_url`, falls back to `user_metadata`, mirroring how
`getAssetType` resolves the type) and used it when building gallery
items and in `getAssetUrl`.
Measured against a local backend — same file, same name, only the
address differs:
| Request | Response |
| --- | --- |
| `viewvideo?filename=clip.webm&type=output&subfolder=` (file at output
root) | 200, 910017 b |
| `viewvideo?filename=clip.webm&type=output&subfolder=sub` (file in
`sub/`) | 200, 910017 b |
| `viewvideo?filename=clip.webm&type=output&subfolder=` (file in `sub/`)
| **204, 0 b** |
The endpoint handles subfolders correctly; only the URL the lightbox
constructed failed. This also matches the 204 independently reported in
#7192, and explains why the same videos play from Job History (which
builds result items from real queue data) and why the bug only appears
with a `filename_prefix` containing a directory.
## Review Focus
`getAssetSubfolder` prefers `preview_url` over `user_metadata` because
`preview_url` is already the trusted source for the `url` getter and for
`getAssetType`. `getAssetUrl` previously read `user_metadata` only; that
path is preserved as the fallback, so its behaviour is unchanged when
`preview_url` carries no subfolder.
Not addressed here, to keep this focused: the same constructor
hard-codes `type: 'output'`, which is wrong for imported (input) videos.
`ResultItem['type']` is a narrow union while `getAssetType` returns
`string`, so that needs its own change. Every case reported in #7192 is
an output.
Fixes #71921 parent 3e1b0d2 commit b09bd9e
3 files changed
Lines changed: 105 additions & 4 deletions
File tree
- src
- components/sidebar/tabs
- platform/assets/utils
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
229 | 229 | | |
230 | 230 | | |
231 | 231 | | |
232 | | - | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
233 | 236 | | |
234 | 237 | | |
235 | 238 | | |
| |||
457 | 460 | | |
458 | 461 | | |
459 | 462 | | |
460 | | - | |
| 463 | + | |
461 | 464 | | |
462 | 465 | | |
463 | 466 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
0 commit comments