Don't add https:// prefix to empty website urls
This commit is contained in:
@@ -98,6 +98,9 @@ struct Profile: Codable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var website_url: URL? {
|
var website_url: URL? {
|
||||||
|
if self.website?.trimmingCharacters(in: .whitespacesAndNewlines) == "" {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
return self.website.flatMap { url in
|
return self.website.flatMap { url in
|
||||||
let trim = url.trimmingCharacters(in: .whitespacesAndNewlines)
|
let trim = url.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||||
if !(trim.hasPrefix("http://") || trim.hasPrefix("https://")) {
|
if !(trim.hasPrefix("http://") || trim.hasPrefix("https://")) {
|
||||||
|
|||||||
Reference in New Issue
Block a user