Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

Fix Windows cursor telemetry path resolution

Etienne Lescote72fb8252ccb
diff --git a/src/components/video-editor/VideoEditor.tsx b/src/components/video-editor/VideoEditor.tsx
index ac9a9f4fb..67e81d715 100644
--- a/src/components/video-editor/VideoEditor.tsx
+++ b/src/components/video-editor/VideoEditor.tsx
@@ -419,7 +419,9 @@ export default function VideoEditor() {
let mounted = true;
async function loadCursorTelemetry() {
- if (!videoPath) {
+ const sourcePath = videoSourcePath ?? (videoPath ? fromFileUrl(videoPath) : null);
+
+ if (!sourcePath) {
if (mounted) {
setCursorTelemetry([]);
}
@@ -427,7 +429,7 @@ export default function VideoEditor() {
}
try {
- const result = await window.electronAPI.getCursorTelemetry(fromFileUrl(videoPath));
+ const result = await window.electronAPI.getCursorTelemetry(sourcePath);
if (mounted) {
setCursorTelemetry(result.success ? result.samples : []);
}
@@ -444,7 +446,7 @@ export default function VideoEditor() {
return () => {
mounted = false;
};
- }, [videoPath]);
+ }, [videoPath, videoSourcePath]);
function togglePlayPause() {
const playback = videoPlaybackRef.current;
diff --git a/src/components/video-editor/projectPersistence.ts b/src/components/video-editor/projectPersistence.ts
index 9339770ad..b1aa34635 100644
--- a/src/components/video-editor/projectPersistence.ts
+++ b/src/components/video-editor/projectPersistence.ts
@@ -61,9 +61,9 @@ function clamp(value: number, min: number, max: number) {
export function toFileUrl(filePath: string): string {
const normalized = filePath.replace(/\\/g, "/");
if (normalized.match(/^[a-zA-Z]:/)) {
- return `file:///${normalized}`;
+ return `file:///${encodeURI(normalized)}`;
}
- return `file://${normalized}`;
+ return `file://${encodeURI(normalized)}`;
}
export function fromFileUrl(fileUrl: string): string {
@@ -73,9 +73,20 @@ export function fromFileUrl(fileUrl: string): string {
try {
const url = new URL(fileUrl);
- return decodeURIComponent(url.pathname);
+ const pathname = decodeURIComponent(url.pathname);
+
+ if (url.host && url.host !== "localhost") {
+ return `//${url.host}${pathname}`;
+ }
+
+ if (/^\/[a-zA-Z]:/.test(pathname)) {
+ return pathname.slice(1);
+ }
+
+ return pathname;
} catch {
- return fileUrl.replace(/^file:\/\//, "");
+ const fallbackPath = decodeURIComponent(fileUrl.replace(/^file:\/\//, ""));
+ return fallbackPath.replace(/^\/([a-zA-Z]:)/, "$1");
}
}