Fix folder link slug

This commit is contained in:
Ali 2023-04-27 13:03:36 +04:00
parent 68238bd59f
commit 0211fc2c9c
2 changed files with 7 additions and 3 deletions

View File

@ -47,7 +47,11 @@ public final class QrCodeScreen: ViewController {
case let .invite(invite, _):
return invite.link ?? ""
case let .chatFolder(slug):
return slug
if slug.hasPrefix("https://") {
return slug
} else {
return "https://t.me/addlist/\(slug)"
}
}
}

View File

@ -59,8 +59,8 @@ public struct ExportedChatFolderLink: Equatable {
public extension ExportedChatFolderLink {
var slug: String {
var slug = self.link
if slug.hasPrefix("https://t.me/folder/") {
slug = String(slug[slug.index(slug.startIndex, offsetBy: "https://t.me/folder/".count)...])
if slug.hasPrefix("https://t.me/addlist/") {
slug = String(slug[slug.index(slug.startIndex, offsetBy: "https://t.me/addlist/".count)...])
}
return slug
}