We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 346909a commit c40fe4eCopy full SHA for c40fe4e
common/src/util/string.ts
@@ -155,14 +155,22 @@ export const snakeToTitleCase = (str: string): string => {
155
* Uses http:// for localhost and local IPs, https:// for all other domains
156
*/
157
export const ensureUrlProtocol = (url: string): string => {
158
- if (url.startsWith('http://') || url.startsWith('https://')) {
+ if (
159
+ url.startsWith('http://') ||
160
+ url.startsWith('https://') ||
161
+ url.startsWith('file://')
162
+ ) {
163
return url
164
}
165
166
if (url.startsWith('localhost') || url.match(/^127\.\d+\.\d+\.\d+/)) {
167
return `http://${url}`
168
169
170
+ if (url.startsWith('/')) {
171
+ return `file://${url}`
172
+ }
173
+
174
return `https://${url}`
175
176
0 commit comments