mirror of
https://github.com/HeyPuter/puter.git
synced 2026-08-25 23:46:51 +00:00
fix: prevent crash rendering website files without a workers array in Dashboard Files
TabFiles.renderItem accessed `file.workers.length` unguarded when deciding whether to show the website badge. Directory entries that have a published website but no `workers` array (the common case) made this throw `Cannot read properties of undefined (reading 'length')`, so the row failed to render — the file silently disappeared from the list (swallowed by the Promise.allSettled batch) or was never added on socket-driven updates. The sibling `is_worker` derivation on the same entry already guards with `file.workers?.length`, and the desktop reference (UIItem.js) normalizes `workers` to an array and shows the badge via `!is_worker`. Reuse the safe `is_worker` flag here instead of touching `file.workers.length` directly.
This commit is contained in:
@@ -2050,9 +2050,9 @@ const TabFiles = {
|
||||
${icon}
|
||||
</div>
|
||||
<div class="item-badges">
|
||||
<img class="item-badge item-has-website-badge long-hover"
|
||||
style="${file.has_website && file.workers.length === 0 ? 'display:block;' : ''}"
|
||||
src="${html_encode(window.icons['world.svg'])}"
|
||||
<img class="item-badge item-has-website-badge long-hover"
|
||||
style="${file.has_website && !is_worker ? 'display:block;' : ''}"
|
||||
src="${html_encode(window.icons['world.svg'])}"
|
||||
data-item-id="${item_id}"
|
||||
/>
|
||||
<img class="item-badge item-has-website-url-badge"
|
||||
|
||||
Reference in New Issue
Block a user