fixed absolute url in the vtt file (#610)

fixed the type file path
This commit is contained in:
VaSeala authored and GitHub committed 2023-08-31 16:57:23 +08:00
1 parent 1fe653e3c3
commit cafff9b155
2 files changed
+8 -4

No files matched your search

@@ -43,10 +43,14 @@ export default async function getVttArray(vttUrl = '') {
const start = Math.floor(t2d(timeMatch[1]));
const end = Math.floor(t2d(timeMatch[2]));
const urlArr = vttUrl.split('/');
urlArr.pop();
urlArr.push(textMatch[1]);
const url = urlArr.join('/');
let url = textMatch[1];
const isAbsoluteUrl = /^\/|((https?|ftp|file):\/\/)/i.test(url);
if (!isAbsoluteUrl) {
const urlArr = vttUrl.split('/');
urlArr.pop();
urlArr.push(url);
url = urlArr.join('/');
}
const result = { start, end, url };