server/plugin: don't panic on whitespace in Jitsi Server URL#282
Open
SAY-5 wants to merge 1 commit into
Open
Conversation
startMeeting discarded the error from url.Parse and then read jURL.Hostname(), so an admin who pasted a URL with a leading or trailing space saw the plugin crash on the first /jitsi invocation (mattermost-community#281). url.Parse(" https://...") returns (nil, err) because the space breaks scheme parsing; IsValid() on config-change doesn't catch the whitespace either. Parse the already-trimmed jitsiURL local (not the raw config string), check the error, and surface a user-visible 'misconfigured' message instead of panicking. Signed-off-by: SAY-5 <SAY-5@users.noreply.github.com> Fixes mattermost-community#281
SAY-5
force-pushed
the
fix/startmeeting-nil-url-281
branch
from
May 31, 2026 02:40
8add5d1 to
0b69112
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
startMeetinginserver/plugin.godiscarded the error fromurl.Parseand then readjURL.Hostname():url.Parse(" https://...")returns(nil, err)because the leading space breaks scheme parsing, andIsValid()runs on config change, not per command. So an admin who pasted a URL with trailing or leading whitespace saw the plugin panic on the first/jitsiinvocation (#281) and every subsequent command returned the opaque "plugin crashed, contact your administrator" message.Fixes #281.
Change
jitsiURLlocal variable (which isstrings.TrimSpace(...)'d a few lines up) instead of the raw config value, so trimming actually reachesurl.Parse.parseErr != nil || jURL == nil, return"Jitsi plugin is misconfigured: invalid Jitsi Server URL"viaerrors.New(the already-importedgithub.com/pkg/errors).Testing
go build ./server/...passes.JitsiURLto" https://meet.example.com "(spaces on both sides). Previously/jitsipanicked inside the plugin goroutine; now it returns the misconfigured-message error and the plugin keeps running.