From 5d7be045eda1a21cbd2fee012a41c40088ad4361 Mon Sep 17 00:00:00 2001 From: Franco Montenegro <franco.montenegro.ruke@gmail.com> Date: Tue, 10 Aug 2021 21:14:51 -0300 Subject: [PATCH] Reset file input on publishing when accessing since it can be restored to previous value. --- ui/component/publishForm/view.jsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ui/component/publishForm/view.jsx b/ui/component/publishForm/view.jsx index 2089fb6ca..e0455cad4 100644 --- a/ui/component/publishForm/view.jsx +++ b/ui/component/publishForm/view.jsx @@ -532,6 +532,15 @@ function PublishForm(props: Props) { } }, [autoSwitchMode, editingURI, fileMimeType, myClaimForUri, mode, setMode, setAutoSwitchMode]); + // When accessing to publishing, make sure to reset file input attributes + // since we can't restore from previous user selection (like we do + // with other properties such as name, title, etc.) for security reasons. + useEffect(() => { + if (mode === PUBLISH_MODES.FILE) { + updatePublishForm({ filePath: '', fileDur: 0, fileSize: 0 }); + } + }, [mode, updatePublishForm]); + if (publishing) { return ( <div className="main--empty"> -- 2.45.3