mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-28 22:15:12 -04:00
Fix security related problems (#1522)
* Remove unnecessary capture group from regex Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de> * Rename component to make name more expressive Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de> * Remove redundant expression Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de> * Filter vbscript links Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de> * Remove superfluous parameter Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de> * Check if handler is set Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de> * Fix doc Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
0e512531a0
commit
87d6285da5
8 changed files with 17 additions and 11 deletions
|
@ -15,9 +15,12 @@ interface RouteParameters {
|
|||
id: string
|
||||
}
|
||||
|
||||
export const Redirector: React.FC = () => {
|
||||
/**
|
||||
* Redirects the user to the editor if the link is a root level direct link to a version 1 note.
|
||||
*/
|
||||
export const NoteDirectLinkRedirector: React.FC = () => {
|
||||
const { id } = useParams<RouteParameters>()
|
||||
const [error, setError] = useState<boolean | null>(null)
|
||||
const [error, setError] = useState<boolean | undefined>(undefined)
|
||||
|
||||
useEffect(() => {
|
||||
getNote(id)
|
||||
|
@ -25,9 +28,9 @@ export const Redirector: React.FC = () => {
|
|||
.catch(() => setError(true))
|
||||
}, [id])
|
||||
|
||||
if (error) {
|
||||
if (error === true) {
|
||||
return <NotFoundErrorScreen />
|
||||
} else if (!error && error != null) {
|
||||
} else if (error === false) {
|
||||
return <Redirect to={`/n/${id}`} />
|
||||
} else {
|
||||
return <span>Loading</span>
|
Loading…
Add table
Add a link
Reference in a new issue