graasp / graasp/graasp-api

[BUG] Item name regex validation does not allow NBSP characters and other special white space elements

Open
#1,336 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
7
Forks
5
PR merge metrics
No merged PRs in 30d

Description

The item name regex is defined as `^\S+( \S+)*$` which allows any amount of words separated by spaces (only regular spaces).

if using `NBSP` non-breaking spaces it will fail.

When creating links the title of pages may contain other types of whitespace as only standard spaces, so it will fail with a nasty error message.

### Solution

1. Remove the regex as it does not provide a lot of safety anyway...
2. Sanitize the strings we get from page titles for links to avoid the validation issue. (this will only push back the problem)
3. allow any type of white space instead of only spaces by replacing `^\S+( \S+)*$` with `^\S+(\s\S+)*$` (this also allows tabs and carriage returns).

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.