mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-08 12:37:05 +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
|
||||
*/
|
||||
function validateServerAddress(input: string): string {
|
||||
// Trim the last slash if needed
|
||||
if (input.endsWith("/")) {
|
||||
input = input.substring(0, input.length - 1);
|
||||
}
|
||||
input = input.trim();
|
||||
|
||||
// Trim the trailing slashes
|
||||
input = input.replace(/\/+$/, "");
|
||||
|
||||
// If it isn't HTTP protocol
|
||||
if ((!input.startsWith("https://") && !input.startsWith("http://"))) {
|
||||
|
||||
Reference in New Issue
Block a user