ryanb / letter_opener

Preview mail in the browser instead of sending.
MIT License
3.71k stars 236 forks source link

Launchy issue with macOS Big Sur? #180

Closed cpanderson closed 2 years ago

cpanderson commented 3 years ago

In delivery_method.rb on line 24 this...

Launchy.open("file:///#{messages.first.filepath}")

...throws an error in the log...

The file /Users/<...>/file:<...>/tmp/letter_opener/1606671849_901567_0e46b31/rich.html does not exist

Not sure if it's related to how Launchy uses /usr/bin/open and if that has changed but doing this fixes it...

Launchy.open("#{messages.first.filepath}")

nashby commented 3 years ago

@cpanderson hey! Sorry for late response! Yes, this should fix the issue. As far as I remember we didn't have file:/// protocol before. We only added it to fix some issues on Windows I guess. But I think we can bring that back and see how it works. Would you mind sending a PR?

P.S you don't need interpolation here, just

Launchy.open(messages.first.filepath)
bindzus commented 2 years ago

@nashby the current gem does not include this fix, any way to monkey patch it?

nashby commented 2 years ago

@bindzus @cpanderson hey! Could you please test current master and see if it works for you? By default we don't add file:// prefix anymore so it should work with Big Sur (don't have it right now so would really appreciate a test). If you still want to add any prefix you can do it with following config:

LetterOpener.configure do |config|
  config.file_uri_scheme = 'file://'
end