Reset file input on publishing when accessing since it can be restored to previous value. (#6855)

This commit is contained in:
Franco Montenegro 2021-08-19 13:50:58 -03:00 committed by GitHub
parent 618b9a4d3e
commit 57ac473b00
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -547,6 +547,15 @@ function PublishForm(props: Props) {
} }
}, [autoSwitchMode, editingURI, fileMimeType, myClaimForUri, mode, setMode, setAutoSwitchMode]); }, [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) { if (publishing) {
return ( return (
<div className="main--empty"> <div className="main--empty">