Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Safari History/Bookmarks #3

Open
miklb opened this issue Jan 17, 2023 · 9 comments
Open

Safari History/Bookmarks #3

miklb opened this issue Jan 17, 2023 · 9 comments

Comments

@miklb
Copy link

miklb commented Jan 17, 2023

attempting to use On Trying (Safari history shows "On Trying | danksinker.com" with link to https://dansinker.com/posts/trying/ ) I receive this error

The action “Run Shell Script” encountered an error: “-e:2088:in `get_safari_bookmarks': undefined method `[]' for nil:NilClass (NoMethodError)
from -e:2066:in `search_safari_bookmarks'
from -e:2104:in `block in search_history'
from -e:2103:in `each'
from -e:2103:in `search_history'
from -e:2883:in `do_search'
from -e:1059:in `block (2 levels) in parse'
from -e:862:in `gsub!'
from -e:862:in `block in parse'
from -e:836:in `each'
from -e:836:in `each_with_index'
from -e:836:in `parse'
from -e:3089:in `<main>'”

I can confirm I have a .searchlink file in my root user directory and includes the default

history_types:
- safari_bookmarks
- safari_history

Do I need to grant permission to the service for bookmarks/history? FWIW I'm running 13.2 Beta (22D5038i)

@ttscoff
Copy link
Owner

ttscoff commented Jan 20, 2023

Hrm. That's going to be hard to track down. It indicates that it's not reading the xml file properly to begin with, but I'd have to be able to replicate the error to figure out exactly where the issue is.

What do you get if you open Terminal and run:

plutil -convert xml1 -o - ~/Library/Safari/Bookmarks.plist

@miklb
Copy link
Author

miklb commented Jan 23, 2023

It outputs quite a bit of data as XML.

I attempted the action again and I get a new error

The action “Run Shell Script” encountered an error: “-e:1711: warning: found `= literal' in conditional, should be ==
-e:1485:in `get_safari_bookmarks': undefined method `[]' for nil:NilClass (NoMethodError)

@ttscoff
Copy link
Owner

ttscoff commented Jan 23, 2023 via email

@ttscoff
Copy link
Owner

ttscoff commented Jan 23, 2023 via email

@miklb
Copy link
Author

miklb commented Jan 25, 2023

I tested the latest zip with similar results. I read the release notes on building the gem locally and nothing too daunting there so I'm happy to try and help with deeper debugging next chance I get.

Latest full error message

The action “Run Shell Script” encountered an error: “-e:2359:in `get_safari_bookmarks': undefined method `[]' for nil:NilClass (NoMethodError)
from -e:2303:in `search_safari_bookmarks'
from -e:2503:in `block in search_history'
from -e:2502:in `each'
from -e:2502:in `search_history'
from -e:2487:in `search'
from -e:1104:in `block (2 levels) in do_search'
from -e:69:in `block in search_with_timeout'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/timeout.rb:93:in `block in timeout'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/timeout.rb:33:in `block in catch'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/timeout.rb:33:in `catch'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/timeout.rb:33:in `catch'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/timeout.rb:108:in `timeout'
from -e:68:in `search_with_timeout'
from -e:1105:in `block in do_search'
from -e:1102:in `each'
from -e:1102:in `do_search'
from -e:3389:in `do_search'
from -e:3921:in `block (2 levels) in parse'
from -e:3678:in `gsub!'
from -e:3678:in `block in parse'
from -e:3652:in `each'
from -e:3652:in `each_with_index'
from -e:3652:in `parse'
from -e:4432:in `<main>'”

@miklb
Copy link
Author

miklb commented Jan 25, 2023

I tried installing an updated version of Ruby (3.2.0) using Homebrew - rbenv and ruby-build but it seems the service defaults to using /System/Library/Frameworks/Ruby.framework/Versions/2.6/ regardless.

@ttscoff
Copy link
Owner

ttscoff commented Jan 25, 2023 via email

@ttscoff
Copy link
Owner

ttscoff commented Jan 25, 2023

Oh, you did mean the service version. It's actually good that it uses a consistent ruby, makes my life easier :).

@ttscoff
Copy link
Owner

ttscoff commented Jan 25, 2023

I tested the latest zip with similar results. I read the release notes on building the gem locally and nothing too daunting there so I'm happy to try and help with deeper debugging next chance I get.

Latest full error message

The action “Run Shell Script” encountered an error: “-e:2359:in `get_safari_bookmarks': undefined method `[]' for nil:NilClass (NoMethodError)

So I can prevent this error from being thrown, but the fact that the object is nil indicates it's not finding the bookmarks to begin with, or that the format is unexpected. It's working fine for me locally, but I literally only have one variation of the bookmarks file to examine. Try this version and see if you get at least a different error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants