Don't try save bookmarks for remote URLs

This commit is contained in:
Arkadiusz Fal 2022-11-25 19:36:23 +01:00
parent 53620c4d35
commit e8515d63e3

View File

@ -23,6 +23,11 @@ struct URLBookmarkModel {
return return
} }
guard url.isFileURL else {
logger.error("trying to save bookmark for something that is not a file")
return
}
if let bookmarkData = try? url.bookmarkData(options: bookmarkCreationOptions, includingResourceValuesForKeys: nil, relativeTo: nil) { if let bookmarkData = try? url.bookmarkData(options: bookmarkCreationOptions, includingResourceValuesForKeys: nil, relativeTo: nil) {
defaults.set(bookmarkData, forKey: bookmarkKey(url)) defaults.set(bookmarkData, forKey: bookmarkKey(url))
logger.info("saved bookmark for \(bookmarkKey(url))") logger.info("saved bookmark for \(bookmarkKey(url))")