From b8b71f8b02699c1eb93832ee9ac7424c3a404e71 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 30 Jan 2026 13:38:40 +0000 Subject: [PATCH] fix: blossom blob command now parses --type flag - Added mediaType and blobUrl fields to BlossomCommandResult - Blob subcommand now parses --type image|video|audio flag - Fixed server URL overflow in blob detail view with truncation https://claude.ai/code/session_01AeeN5d5EcVLGjZbGueZxaD --- src/components/BlossomViewer.tsx | 6 ++++-- src/lib/blossom-parser.ts | 30 ++++++++++++++++++++++++++++-- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/src/components/BlossomViewer.tsx b/src/components/BlossomViewer.tsx index 94cb1cc..c39683b 100644 --- a/src/components/BlossomViewer.tsx +++ b/src/components/BlossomViewer.tsx @@ -1186,8 +1186,10 @@ function BlobDetailView({ Server
- - {serverUrl} + + + {serverUrl} +
)} diff --git a/src/lib/blossom-parser.ts b/src/lib/blossom-parser.ts index 515fbd4..077b197 100644 --- a/src/lib/blossom-parser.ts +++ b/src/lib/blossom-parser.ts @@ -34,6 +34,10 @@ export interface BlossomCommandResult { // For 'mirror' subcommand sourceUrl?: string; targetServer?: string; + // For 'blob' subcommand - media type hint for preview + mediaType?: "image" | "video" | "audio"; + // For 'blob' subcommand - full blob URL with extension + blobUrl?: string; } /** @@ -166,17 +170,39 @@ export async function parseBlossomCommand( case "view": { if (args.length < 2) { throw new Error( - "SHA256 hash required. Usage: blossom blob [server]", + "SHA256 hash required. Usage: blossom blob [server] [--type image|video|audio]", ); } const sha256 = args[1].toLowerCase(); if (!/^[0-9a-f]{64}$/.test(sha256)) { throw new Error("Invalid SHA256 hash. Must be 64 hex characters."); } + + // Parse remaining args for server and --type flag + let serverUrl: string | undefined; + let mediaType: "image" | "video" | "audio" | undefined; + + for (let i = 2; i < args.length; i++) { + if (args[i] === "--type" && args[i + 1]) { + const typeArg = args[i + 1].toLowerCase(); + if ( + typeArg === "image" || + typeArg === "video" || + typeArg === "audio" + ) { + mediaType = typeArg; + } + i++; // Skip the type value + } else if (!args[i].startsWith("--") && !serverUrl) { + serverUrl = normalizeServerUrl(args[i]); + } + } + return { subcommand: "blob", sha256, - serverUrl: args[2] ? normalizeServerUrl(args[2]) : undefined, + serverUrl, + mediaType, }; }