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

ShellAnything Errors out when opening a context on Google Docs/Sheets/etc #121

Closed
hboyd2003 opened this issue Feb 22, 2023 · 3 comments
Closed
Labels
bug Something isn't working
Milestone

Comments

@hboyd2003
Copy link

Describe the bug
When right clicking on any Google Document (.gdocs/.gsheet/etc) a dialog opens up stating there was a problem opening the file. The dialog appears three times in total. After you close them all, the context menu opens normally including all of the ShellAnything entries.

To Reproduce

  1. Go to a mounted Google Drive drive
  2. Write click on any google document file (.gdocs/.gsheet/etc)

Expected behavior
Context menu opens without erring out.

Screenshots
The Error Dialog
Photo of the error dialog

Environment

  • OS: Windows 11 22H2
  • Version 0.07 & '0.08'

Additional context

  • I was not able to test this outside of my Google Drive as windows copy does not work on these files either
  • The log gives no warnings or errors to this error.
  • The log states that the file is found (in direct contradiction to dialog)
  • The error appears even when no ShellAnything entries are enabled (no .xml files)
@hboyd2003 hboyd2003 added the bug Something isn't working label Feb 22, 2023
@end2endzone
Copy link
Owner

end2endzone commented Feb 28, 2023

Hi. Sorry for the late reply.

Congratulation for finding this and thank you for reporting it.

Shell anything tries to read the first bytes of the selected file to properly detect the file's mimetype. This is a new feature similar to Unix's file command. Base on this result, menus can be hidden or showed.

I think you are the first one to encounter and report this bug. I think this is because your selected file is open in your editor. The file cannot be read because it is locked by another process, probably from your file editor or the process who synchronize your directory/file with your Google drive.

If Shell anything encounter such error while trying to peak into a file, an error message should not be displayed. Shell anything should expect an "unknown" mimetype and continue with normal behavior.

I have other properties priorities (other issues) that I need to look for at this time. As soon as I am available, I will look at this. On a side note, I would gladly accept any help. If you would like to offer your help, I will accept a push request.

Thank you.

EDIT: Typos.

@end2endzone end2endzone added this to the 0.8.0 milestone May 1, 2023
end2endzone added a commit that referenced this issue May 28, 2023
…. Now logging errors instead of showing a popup error message. #121
@end2endzone
Copy link
Owner

I created more unit tests in 54de08c to reproduce your issue with a "file lock" error. I was not able to reproduce your observation (I do not have a Google Drive). Even when the file is locked by the operating system, the magic library does not fail as you observed.

In my last commit, I have modified how ShellAnything deals with errors related to magic library. It is now logging errors to the error log file instead of showing a popup error message. This will solve the unexpected error prompt to users.

If you right-click on a locked file, ShellAnything now generates the following properties:

selection.mimetype=writable, executable, regular file, no read permission
selection.description=writable, executable, regular file, no read permission
selection.charset=writable, executable, regular file, no read permission

I am unable to find a fix for Spreadsheet files on Google Drive. These files may be "unreadable" similar to when a file is locked. If the magic library cannot read the file I think there are no workaround. The magic library needs to be able to read the beginning of a file to detect "what" the file is.

If you try to right-click on a file on your Goodle Drive, you should see an error in your log files. For example:
Failed to get mime type of file '<path>'. <magic-error-description>. where <path> is the actual path to your Google Drive spreadsheet and <magic-error-description> is a more descriptive error provided by the magic library. If you do not consider the issue resolved, please open a new issue and specify the actual <path> that you see in your logs.

end2endzone added a commit that referenced this issue Jul 1, 2023
@end2endzone
Copy link
Owner

Fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants