mirror of
https://github.com/Sea-Haven-Industries/shoc-frontend-new.git
synced 2026-10-01 03:53:11 +00:00
Use XHR for media progress so Ky does not stream the body on HTTP/1.1 (Vite proxy), and keep completion vs extra tiles from mixing after upload.
10 lines
460 B
TypeScript
10 lines
460 B
TypeScript
/**
|
|
* why: uploads are stored as `{guid}_{original name}`, so the raw storage name shown in media
|
|
* tiles reads as an id. The original name (and its extension) survive after the prefix.
|
|
*/
|
|
const STORED_NAME_PREFIX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}_/i;
|
|
|
|
export function toDisplayFileName(fileName: string): string {
|
|
const withoutPrefix = fileName.replace(STORED_NAME_PREFIX, "").trim();
|
|
return withoutPrefix || fileName;
|
|
}
|