Skip to content
Source
Sign inSign up
pingdotgg/t3code

feat(composer): drop non-image files as filesystem paths #7749

Closednioasoft(GitHub profile, opens in a new tab)wants to merge 4 commits intomain fromrefs/pull/7749/headopened View on GitHub

Showing 5 changed files with 112 additions and 3 deletions (loading 2).

x
0 of 5 viewed, 5 left
10 additions and 1 deletionapps/desktop/src/preload.tsModified
View file
@@ -5,7 +5,7 @@
DesktopPreviewTabState,
} from "@t3tools/contracts";
import { exposeClerkBridge } from "@clerk/electron/preload";
-import { contextBridge, ipcRenderer } from "electron";
+import { contextBridge, ipcRenderer, webUtils } from "electron";
​
import * as IpcChannels from "./ipc/channels.ts";
​
@@ -35,6 +35,15 @@
return result as ReturnType<DesktopBridge["getAppBranding"]>;
},
+ getPathForFile: (file: File) => {
+ // Throws for a File that never came from the OS (e.g. built by the page).
+ try {
+ const path = webUtils.getPathForFile(file);
+ return path.length > 0 ? path : null;
+ } catch {
+ return null;
+ }
+ },
getSystemLocale: () => {
const result = ipcRenderer.sendSync(IpcChannels.GET_SYSTEM_LOCALE_CHANNEL);
return typeof result === "string" ? result : null;
61 additions and 2 deletionsapps/web/src/components/chat/ChatComposer.tsxModified
View file