Skip to content

Trim domain to first word in server URL #693

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
13 changes: 12 additions & 1 deletion app/renderer/js/utils/domain-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,17 @@ class DomainUtil {
return false;
}

trimDomain(domain) {
/*
sometimes, the app is unable to fetch realm_name
we then show the first letter character after the protocol scheme
instead of the first character of the realm_name
*/
let subDomain = domain.substring(domain.lastIndexOf('://') + 3);
subDomain = subDomain.substring(0, subDomain.indexOf('.'));
return subDomain;
}

// ignoreCerts parameter helps in fetching server icon and
// other server details when user chooses to ignore certificate warnings
checkDomain(domain, ignoreCerts = false, silent = false) {
Expand Down Expand Up @@ -142,7 +153,7 @@ class DomainUtil {
const serverConf = {
icon: defaultIconUrl,
url: domain,
alias: domain,
alias: this.trimDomain(domain),
ignoreCerts
};

Expand Down