Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
address review (codex): reject protocol-relative //host previews as imageUrl to match server schema (#1455)
Adam Eivy092ea3bc8167
diff --git a/client/src/components/media/PinToMoodBoardMenu.jsx b/client/src/components/media/PinToMoodBoardMenu.jsxindex f25e146f18..8dbf34fc87 100644--- a/client/src/components/media/PinToMoodBoardMenu.jsx+++ b/client/src/components/media/PinToMoodBoardMenu.jsx@@ -53,9 +53,10 @@ export default function PinToMoodBoardMenu({ item, size = 'sm' }) {// A real media-key only when it matches the server vocabulary; synthetic keys// (canon-sheet:/comic-page:/noun:) fall through to an imageUrl-only pin.const mediaKey = isValidMediaKey(item.key) ? item.key : null;- // Only http(s) / absolute app paths are valid imageUrls (matches the board- // item schema); a missing/blob preview is dropped.- const thumbUrl = typeof item.previewUrl === 'string' && /^(https?:\/\/|\/)/.test(item.previewUrl)+ // Only http(s) / absolute app paths are valid imageUrls (mirror the board+ // item schema, which rejects a protocol-relative `//host` path even though it+ // starts with `/`); a missing/blob/protocol-relative preview is dropped.+ const thumbUrl = typeof item.previewUrl === 'string' && /^(https?:\/\/|\/(?!\/))/.test(item.previewUrl)? item.previewUrl: null;// The board item payload: a real media-key for source linkage + dedup when wediff --git a/client/src/components/media/PinToMoodBoardMenu.test.jsx b/client/src/components/media/PinToMoodBoardMenu.test.jsxindex 48e61a167f..fe6545db73 100644--- a/client/src/components/media/PinToMoodBoardMenu.test.jsx+++ b/client/src/components/media/PinToMoodBoardMenu.test.jsx@@ -128,4 +128,21 @@ describe('PinToMoodBoardMenu', () => {expect(container).toBeEmptyDOMElement();expect(screen.queryByTitle('Pin to mood board')).toBeNull();});++ it('drops a protocol-relative preview as a thumbnail (server rejects //host imageUrls)', async () => {+ api.listMoodBoards.mockResolvedValue([{ id: 'b1', name: 'Refs', items: [] }]);+ api.addMoodBoardItem.mockResolvedValue({ id: 'mbi-4', type: 'image', mediaKey: 'image:hero.png' });++ // Valid media-key + a protocol-relative preview: pin the key, NOT the bad URL.+ render(<PinToMoodBoardMenu item={{ kind: 'image', key: 'image:hero.png', previewUrl: '//evil/x.png' }} />);+ fireEvent.click(screen.getByTitle('Pin to mood board'));+ const row = await screen.findByRole('menuitemcheckbox', { name: /Refs/ });+ await act(async () => { fireEvent.click(row); });++ expect(api.addMoodBoardItem).toHaveBeenCalledWith(+ 'b1',+ { type: 'image', mediaKey: 'image:hero.png' },+ { silent: true },+ );+ });});