City-of-Bloomington / url_shortener

Short URL web service
GNU Affero General Public License v3.0
2 stars 1 forks source link

Do not allow users to have invalid characters in the short code #5

Closed inghamn closed 1 year ago

inghamn commented 1 year ago

The application currently autogenerates a random five character code using a pool of defined characters. However, a user can type whatever they feel like as a code when adding and editing.

The resulting short Url will be correctly url_encoded and the encoded version will work. Even so, it might be surprising for users to not get the verbatim characters they typed as part of the Url.

To avoid this, we could have the application restrict users to the same pool of characters that are used in the random gerenation of codes.