Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

This is where it comes from

Manav Rathi75c058fc4c9a
diff --git a/web/packages/shared/hooks/useFileInput.tsx b/web/packages/shared/hooks/useFileInput.tsx
index 3f7f2d4321..4eb346d39c 100644
--- a/web/packages/shared/hooks/useFileInput.tsx
+++ b/web/packages/shared/hooks/useFileInput.tsx
@@ -1,18 +1,23 @@
import { useCallback, useRef, useState } from "react";
/**
- * TODO (MR): Understand how this is happening, and validate it further (on
- * first glance this is correct).
- *
* [Note: File paths when running under Electron]
*
* We have access to the absolute path of the web {@link File} object when we
* are running in the context of our desktop app.
*
+ * https://www.electronjs.org/docs/latest/api/file-object
+ *
* This is in contrast to the `webkitRelativePath` that we get when we're
* running in the browser, which is the relative path to the directory that the
* user selected (or just the name of the file if the user selected or
* drag/dropped a single one).
+ *
+ * Note that this is a deprecated approach. From Electron docs:
+ *
+ * > Warning: The path property that Electron adds to the File interface is
+ * > deprecated and will be removed in a future Electron release. We recommend
+ * > you use `webUtils.getPathForFile` instead.
*/
export interface FileWithPath extends File {
readonly path?: string;
@@ -49,7 +54,10 @@ interface UseFileInputParams {
* accept can be an extension or a MIME type (See
* https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/accept).
*/
-export default function useFileInput({ directory, accept }: UseFileInputParams) {
+export default function useFileInput({
+ directory,
+ accept,
+}: UseFileInputParams) {
const [selectedFiles, setSelectedFiles] = useState<File[]>([]);
const inputRef = useRef<HTMLInputElement>();