mirror of
https://github.com/owncast/owncast.git
synced 2024-11-22 12:49:37 +03:00
Fix default protocol validation list
This commit is contained in:
parent
5951ce527b
commit
7d2e2537cf
2 changed files with 3 additions and 12 deletions
|
@ -69,16 +69,7 @@ const ActionModal = (props: Props) => {
|
|||
}
|
||||
|
||||
function canSave(): Boolean {
|
||||
try {
|
||||
const validationObject = new URL(actionUrl);
|
||||
if (validationObject.protocol !== 'https:') {
|
||||
return false;
|
||||
}
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
|
||||
return isValidUrl(actionUrl) && actionTitle !== '';
|
||||
return isValidUrl(actionUrl, ['https:']) && actionTitle !== '';
|
||||
}
|
||||
|
||||
const okButtonProps = {
|
||||
|
|
|
@ -7,10 +7,10 @@ export const DEFAULT_TEXTFIELD_URL_PATTERN = 'https?://.*';
|
|||
* @param {string[]} validProtocols - An array of valid protocols. Defaults to web.
|
||||
* @returns {boolean} - True if the URI is valid, false otherwise.
|
||||
*/
|
||||
export function isValidUrl(url: string, validProtocols: string[] = ['http', 'https']): boolean {
|
||||
console.log(url, validProtocols);
|
||||
export function isValidUrl(url: string, validProtocols: string[] = ['http:', 'https:']): boolean {
|
||||
try {
|
||||
const validationObject = new URL(url);
|
||||
|
||||
if (
|
||||
validationObject.protocol === '' ||
|
||||
validationObject.hostname === '' ||
|
||||
|
|
Loading…
Reference in a new issue