escape_leading_slashes
If redirecting to an absolute path (two leading slashes), a slash must be escaped to prevent browsers from handling the path as schemaless and redirecting to another host.
def escape_leading_slashes(
url: string
) - > string
If redirecting to an absolute path (two leading slashes), a slash must be escaped to prevent browsers from handling the path as schemaless and redirecting to another host.
Parameters
| Name | Type | Description |
|---|---|---|
| url | string | The URL string to be checked and potentially escaped to prevent open redirect vulnerabilities. |
Returns
| Type | Description |
|---|---|
string | The URL with leading double slashes replaced by an escaped sequence, or the original URL if it did not start with double slashes. |