mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-10 13:37:04 +03:00
Added better server address trimming.
This commit is contained in:
@@ -357,10 +357,10 @@ function activatePrivateTextChange(element: HTMLElement) {
|
|||||||
* @param input Input server address
|
* @param input Input server address
|
||||||
*/
|
*/
|
||||||
function validateServerAddress(input: string): string {
|
function validateServerAddress(input: string): string {
|
||||||
// Trim the last slash if needed
|
input = input.trim();
|
||||||
if (input.endsWith("/")) {
|
|
||||||
input = input.substring(0, input.length - 1);
|
// Trim the trailing slashes
|
||||||
}
|
input = input.replace(/\/+$/, "");
|
||||||
|
|
||||||
// If it isn't HTTP protocol
|
// If it isn't HTTP protocol
|
||||||
if ((!input.startsWith("https://") && !input.startsWith("http://"))) {
|
if ((!input.startsWith("https://") && !input.startsWith("http://"))) {
|
||||||
|
|||||||
Reference in New Issue
Block a user