diff --git a/plugins/recorder-resources/src/recording.ts b/plugins/recorder-resources/src/recording.ts index 454ea431b4..bd9e5714fc 100644 --- a/plugins/recorder-resources/src/recording.ts +++ b/plugins/recorder-resources/src/recording.ts @@ -50,9 +50,8 @@ export async function record (options: FileUploadOptions): Promise { } async function uploadRecording (recordingName: string, onUploaded: FileUploadCallback): Promise { - const u = new URL(getFileUrl(recordingName)) await onUploaded({ - uuid: getFileUrl(u.toString()) as Ref, + uuid: getBlobUrl(recordingName) as Ref, name: 'Recording-' + now(), file: { ...new Blob(), type: 'video/x-mpegURL' }, path: undefined, @@ -65,3 +64,12 @@ function now (): string { const date = new Date() return date.toLocaleDateString() + ' ' + date.toLocaleTimeString() } + +function getBlobUrl (file: string): string { + const fileUrl = getFileUrl(file) + const u = new URL(fileUrl) + if (u.searchParams.has('file')) { + return u.toString() + } + return fileUrl.split('/').slice(0, -1).join('/') +}