api: return correct extension for gif downloads in api response

This commit is contained in:
dumbmoron
2024-09-18 18:03:04 +00:00
parent 29f967a3ec
commit d560c0d34a
3 changed files with 18 additions and 5 deletions

View File

@@ -65,3 +65,14 @@ export function merge(a, b) {
return a;
}
export function splitFilenameExtension(filename) {
const parts = filename.split('.');
const ext = parts.pop();
if (!parts.length) {
return [ ext, "" ]
} else {
return [ parts.join('.'), ext ]
}
}