From 9de621d409ec1e01494c081fecda19b99dba398a Mon Sep 17 00:00:00 2001 From: sebastjanartic <45803536-sebastjanartic@users.noreply.replit.com> Date: Fri, 9 Jan 2026 17:07:40 +0000 Subject: [PATCH] Improve video sharing by using cached data instead of live API calls Modify the video share endpoint in routes.ts to retrieve video data from the cache using `storage.getVideos()` instead of making direct API calls with `findVideoByAnyId` and `storage.getVideo()`, which was causing 404 errors. This ensures that share links correctly resolve video details and metadata. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 401e2ec0-e00d-4f10-9d0e-60f3d479f9a5 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 112fcbe4-f903-4480-927e-8bcf6e744878 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/60d372ff-2c10-46c7-b01b-10c3435136b0/401e2ec0-e00d-4f10-9d0e-60f3d479f9a5/Ufka13F --- server/routes.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/server/routes.ts b/server/routes.ts index 1adea2f..1c69c94 100644 --- a/server/routes.ts +++ b/server/routes.ts @@ -1284,7 +1284,19 @@ export async function registerRoutes(app: Express): Promise { app.get('/share/video/:id', async (req, res) => { try { const { id } = req.params; - const video = await findVideoByAnyId(id); + + // Find video from cache (not direct Bunny API to avoid 404 errors) + const allVideos = await storage.getVideos(600, 0); + let video; + + // Check if it's a full UUID or short ID + if (id.length === 36 && id.includes('-')) { + video = allVideos.find(v => v.id === id); + } else if (id.length === 8) { + video = allVideos.find(v => v.id.replace(/-/g, '').substring(0, 8) === id); + } else { + video = allVideos.find(v => v.id.includes(id)); + } if (!video) { return res.status(404).send('Video not found');