api/create-filename: build & sanitize filenames in one place
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
const forbiddenCharsString = ['}', '{', '%', '>', '<', '^', ';', ':', '`', '$', '"', "@", '=', '?', '|', '*'];
|
||||
|
||||
export function convertMetadataToFFmpeg(obj) {
|
||||
const keys = Object.keys(obj);
|
||||
const tags = [
|
||||
@@ -19,14 +17,6 @@ export function convertMetadataToFFmpeg(obj) {
|
||||
return commands;
|
||||
}
|
||||
|
||||
export function cleanString(string) {
|
||||
for (const i in forbiddenCharsString) {
|
||||
string = string.replaceAll("/", "_").replaceAll("\\", "_")
|
||||
.replaceAll(forbiddenCharsString[i], '')
|
||||
}
|
||||
return string;
|
||||
}
|
||||
|
||||
export function getRedirectingURL(url) {
|
||||
return fetch(url, { redirect: 'manual' }).then((r) => {
|
||||
if ([301, 302, 303].includes(r.status) && r.headers.has('location'))
|
||||
|
||||
Reference in New Issue
Block a user