deckgo / deckdeckgo

The web open source editor for presentations
https://deckdeckgo.com
1.64k stars 181 forks source link

starter: ROOM_NAME not defined if title contains a special character #550

Open peterpeterparker opened 4 years ago

peterpeterparker commented 4 years ago

Affected part of DeckDeckGo

Reproduction

https://beta.deckdeckgo.io/hrshtkumar1/my-experience-with-preact-web-development/

Actual Behavior

If the presentation's title contains special character (or just "&"?) then the variable to define the ROOM_NAME to connect the remote control to the presentation isn't correctly set and therefore an exception is throw (see screenshots)

Screenshots

Capture d’écran 2019-12-21 à 08 44 25 Capture d’écran 2019-12-21 à 08 44 30 Capture d’écran 2019-12-21 à 08 44 34
peterpeterparker commented 4 years ago

I could maybe use a regex, something like https://stackoverflow.com/a/11090301/5404186

var outString = sourceString.replace(/[`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi, '');
peterpeterparker commented 4 years ago

@nmattia I think we have to define a new variable for the publishing or does maybe {{DECKDECKGO_DECKNAME}} (https://github.com/deckgo/deckdeckgo/blob/2ddb0ee3f6d9c96fc0a8ea0983a9718ff6f40dfa/infra/handler/src/DeckGo/Handler.hs#L1273) already filters special characters and new lines?

If not I guess we have to define a new one like {{DECKDECKGO_DECKTITLE_FILTERED}} or something.