Skip to content

Commit 8e1280b

Browse files
Update AppListModel.swift
中文路径未经过 URL 编码,导致在调用 Filza 打开时无法正确解析并跳转到目标 dylib 文件
1 parent c76a65c commit 8e1280b

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

TrollFools/AppListModel.swift

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,11 +202,20 @@ final class AppListModel: ObservableObject {
202202

203203
extension AppListModel {
204204
func openInFilza(_ url: URL) {
205-
guard let filzaURL else {
205+
// 获取原始文件路径字符串
206+
let rawPath = url.path
207+
// 对路径进行百分号编码
208+
guard let encodedPath = rawPath.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) else {
209+
// 如果编码失败,尝试打开
210+
UIApplication.shared.open(url)
206211
return
207212
}
208-
let fileURL = filzaURL.appendingPathComponent(url.path)
209-
UIApplication.shared.open(fileURL)
213+
214+
let finalURLString = "filza://view" + encodedPath
215+
216+
guard let finalURL = URL(string: finalURLString) else { return }
217+
218+
UIApplication.shared.open(finalURL)
210219
}
211220

212221
func rebuildIconCache() {

0 commit comments

Comments
 (0)