mirror of
https://github.com/yusufipk/OpenFrame.git
synced 2026-09-12 01:46:08 +00:00
fix(downloads): stop repeating an extension the name already carries
A voice comment's display name is the generated file name, extension included, so appending the extension again downloaded it as <uuid>.webm.webm. Both download paths, the single asset route and the project zip, now append only when the name does not already end in it.
This commit is contained in:
@@ -66,6 +66,14 @@ export function sanitizeAssetDisplayName(
|
||||
return normalized.slice(0, 200);
|
||||
}
|
||||
|
||||
/**
|
||||
* A voice comment's display name is the generated file name, extension and all,
|
||||
* so blindly appending the extension named the download `<uuid>.webm.webm`.
|
||||
*/
|
||||
export function withFileExtension(name: string, extension: string): string {
|
||||
return name.toLowerCase().endsWith(extension.toLowerCase()) ? name : `${name}${extension}`;
|
||||
}
|
||||
|
||||
export function extractImageKeyFromProxyUrl(url: string): string | null {
|
||||
if (!SAFE_IMAGE_PROXY_PATH.test(url)) return null;
|
||||
const filename = url.slice(IMAGE_PROXY_PREFIX.length);
|
||||
|
||||
Reference in New Issue
Block a user