validate more URLs in UrlPreviewService.ts
This commit is contained in:
parent
23267a3a96
commit
d6c2140821
2 changed files with 47 additions and 8 deletions
|
|
@ -176,4 +176,14 @@ export class UtilityService {
|
|||
const host = this.extractDbHost(uri);
|
||||
return this.isFederationAllowedHost(host);
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public getUrlScheme(url: string): string {
|
||||
try {
|
||||
// Returns in the format "https:" or an empty string
|
||||
return new URL(url).protocol;
|
||||
} catch {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue