Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(JitsiConference): Separate conference name validation errors. #2466

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletions JitsiConference.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,21 +131,26 @@ function _getCodecMimeType(codec) {
* and so on...
*/
export default function JitsiConference(options) {
if (!options.name || options.name.toLowerCase() !== options.name.toString()) {
const errmsg
= 'Invalid conference name (no conference name passed or it '
+ 'contains invalid characters like capital letters)!';
const additionalLogMsg = options.name
? `roomName=${options.name}; condition - ${options.name.toLowerCase()}!==${options.name.toString()}`
: 'No room name passed!';

logger.error(`${errmsg} ${additionalLogMsg}`);
const name = options.name;

// Conference name validation
if (!name) {
const errmsg = 'Invalid conference name (no conference name passed)!';

logger.error(`${errmsg} No room name passed!`);
throw new Error(errmsg);
}
if (name.toLowerCase() !== name.toString()) {
const errmsg = 'Invalid conference name (it contains invalid characters like capital letters)!';

logger.error(`${errmsg} roomName=${name}; condition - ${name.toLowerCase()}!==${name.toString()}`);
throw new Error(errmsg);
}

this.connection = options.connection;
this.xmpp = this.connection?.xmpp;

if (this.xmpp.isRoomCreated(options.name, options.customDomain)) {
if (this.xmpp.isRoomCreated(name, options.customDomain)) {
const errmsg = 'A conference with the same name has already been created!';

delete this.connection;
Expand Down
Loading