-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Fix: Fixed an issue where Google Drive wasn't displayed when mounted as a folder #15771
Conversation
Thank you for the contribution. |
@0x5bfa No problem. I would say it's ready to be merged in the sense that it seems to be working based on the steps I followed in the "Steps used to test these changes" section above. However, I just wanted to get a second opinion on the code I wrote on lines 191-196. When Google Drive is mounted as a folder, the value stored in But when Google Drive is mounted as a drive, the value stored in The solution I came up with for this issue was to check if the value stored in The effectiveness/safety of this solution depends on two assumptions:
My particular solution is what allows us to get a useable path from the registry-artifact method regardless of Google Drive's mount point, and therefore what would allow us to potentially remove the old "root_preference_sqlite" mount point detection method if we wanted. So I was just curious what your team's thoughts might be on my approach and on this issue in general. |
I just made a new commit that makes the logic that gets the valid path for a single-character In my opinion, it is now ready to merge. But please let me know if there is anything you want me to change. |
I found two minor issues, Google Drive set to mirror to a user selected folder will show both the redirect drive/folder (This show one Also the Google drive is now always shown in the drives section instead of being hidden like 3.5.6 |
Thank you for noticing this, I'll take a look at it tonight or this weekend. And I'm sorry but can you please let me know what "3.5.6" refers to? |
3.5.6 is the current preview version |
@Josh65-2201 , I looked into the first issue today. I am still working on it, but I just wanted to share what I've found. I took screenshots of the sidebar as it appears on my computer under the following conditions (all with my Google Drive set to mirror files):
As for the second issue, under what conditions is Google Drive hidden in 3.5.6? |
Google drive should always be hidden from the drives section and only show in the cloud drives section. |
Ah okay, I will look into that as well, thank you. |
ff65c93
to
8097ba8
Compare
Sorry for the delay, I'm still investigating how to tell from the Sqlite database tables ("roots" and "media") that Google Drive is mirrored as opposed to just streaming. I'm hoping to have some real time to work on it this weekend. In the meantime, I just wanted to ask, did it cause any issues that I updated the branch the other day? I just clicked the "Update branch" button on GitHub on this PR and then pulled the changes down to my local branch. But I just noticed there is a notification now that @yaira2 "force-pushed the main branch." Was this to fix something I did? And is the way I updated the branch (with a merge commit as opposed to rebase) the preferred way? |
It's unrelated.. That said, we also have protections enabled, so you don't have to worry about accidently pushing to |
702bcbd
to
bbf1840
Compare
Just to give an update, today I figured out how to create logs in separate files of the database inspections I've been doing. I have made a commit to my GoogleDriveDetection branch with this logging in place. I plan to remove this logging once I determine and can demonstrate: A) what this implementation of GetProviders "yield returns", B) what the contents of various Google Drive artifacts are (e.g. registry keys and Sqlite databases), and C) whether any of these artifacts contain useful information for determining user preference configurations that tell us when we should or shouldn't yield return certain paths. I plan to use the logging to gather data related to A, B, and C under these conditions: My code active; Streaming; folder-mounted I also learned about the existence of a "mirror_metadata_sqlite.db" file from this article, it might be useful to try to lookup this database as well. |
2e4f94d
to
98eb6b4
Compare
bbf1840
to
949c9f2
Compare
Thanks for the update. |
dde8a91
to
d0d5c00
Compare
With the two commits that I just made, I think that the first issue Josh I have also confirmed that when running the main branch, that Google Drive still I still have logging in place in case you want to use it to confirm the current Begin copied commit messages: AddMyDriveToPathAndValidate; is_my_drive Renamed The only path we ever get from the media table is the drive letter We only find paths in the roots table whose
The path we get from roots is the one that "goes directly to the store folder With this PR, we now get the "redirect drive/folder" as well, from the registry.
I added a call to my drive shortcut fix; registry logging Handled the case where My Drive is a shortcut (when "My Drive syncing options" Added logging for registry values. |
232d16d
to
cb905e9
Compare
Create separate loggers for gathering data about yield returns and database contents. These logs will be in the same directory as the main "debug.log" file, but they will have the names: debugRootPrefTables debugYieldReturn debugMedia debugRoots They are created fresh each run (old file is deleted before logging starts).
Renamed `ValidatePath` to `AddMyDriveToPathAndValidate`, and made it also append `My Drive' to the path it is given. The only path we ever get from the media table is the drive letter (if `Google Drive streaming location` is set to `Drive letter`, otherwise we get nothing from the media table) followed by `:\`. As such, I added a call to `AddMyDriveToPathAndValidate' on this path. We only find paths in the roots table whose `is_my_drive` is true when `My Drive syncing options` is set to Mirror files. I believe these paths are the ones Josh was referring to when he said > Google Drive set to mirror to a user selected folder will show both the > redirect drive/folder (This show one My Drive folder) and another that goes > directly to the store folder location. The path we get from roots is the one that "goes directly to the store folder location" (hence its `is_my_drive` is true). With this PR, we now get the "redirect drive/folder" as well, from the registry. As such, since Josh said > Preferably it would only show the redirect drive/folder and add /My Drive to > the path, then hide all other locations I added a call to `AddMyDriveToPathAndValidate` on every path we get from the registry, and I made the roots table read loop `continue` if it finds a path whose `is_my_drive` is true.
Handled the case where My Drive is a shortcut (when "My Drive syncing options" is set to "Mirror files"). Added logging for registry values.
Convert switch to if statement at end of AddMyDriveToPathAndValidate. Add some comments to explain the `shellFolderBase` code.
This reverts commit 6b35605.
Move Vanara TODO comment to right above the code that uses it. Replace file-based debug logging with Debug.WriteLine calls between preprocessor checks for Debug mode.
Add Debug.WriteLine logging to track when App.AppModel.GoogleDrivePath is written and read. Add logic to RemoteDrivesService.GetDrivesAsync() that filters out Google Drive by calling GoogleDriveCloudDetector.GetGoogleDriveProvidersFromRegistryAsync(). Adjust GoogleDriveCloudDetector.GetGoogleDriveProvidersFromRegistryAsync() so it can be called from RemoteDrivesService.GetDrivesAsync(), and so it can be told to not append 'My Drive'.
80a6935
to
c802626
Compare
GetGoogleDriveRegistryProvidersAsync: remove one of its loops, rename it, split it up, and add more logging. To ensure we only access the registry once, set `App.AppModel.GoogleDrivePath` in RemovableDrivesService, where we need that path first. Then GoogleDriveCloudDetector can read from it, since it needs the path second. Split up AddMyDriveToPathAndValidate.
6d717a7
to
0b15f18
Compare
I just brought the fork up-to-date with the main repo and made a few minor formatting changes. The CI was failing at first, it was that same issue with the Axe accessibility test with sibling elements, and then there was an x64 Release build fail for some reason (it wouldn't say why), but now everything seems good. Please let me know if you want me to change anything else. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code wise, LGTM.
I haven't checked behavior yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still works as expected since my last review
Thanks for checking. |
Is there anything I can do to help with testing? I made this screen recording of a test I did just now running the repo with my changes under four different config conditions, just to document how I ran it and what I looked for. https://drive.google.com/file/d/1bUYS0T3HQcxmzROW_wlNlP8zQjxze035/view?usp=sharing |
Summary
Registry-artifact-based Google Drive mounting point detection
Add method for reading Google Drive registry artifacts and parsing them as JSON.
Add method for safely traversing the resulting JSON and creating/returning new CloudProvider objects based on the data inside.
Call these methods after the old approach that uses the "root_preference_sqlite" file. Google Drive now appears under Cloud Drives" in the sidebar regardless of whether it is mounted as a drive or a folder.
GoogleDriveCloudDetector private fields
Add private fields to GoogleDriveCloudDetector (GDCD) for the strings used to access/traverse Google Drive registry artifacts.
Add field to GDCD for the logger service so we can log warnings when artifact access/traversal attempts fail.
Icon-file-getting logic
Create method for getting the icon file so we can reuse this logic.
Improve null safety of icon file getting logic.
Resolved / Related Issues
Steps used to test these changes
Under Google Drive Preferences -> Settings -> Google Drive Streaming Location, choose "Folder" or "Drive Letter".
Folder
I opened Files and looked at the sidebar and "Google Drive" was there under "Cloud Drives".
I clicked on "Google Drive" and it opened my drive with all its contents viewable and accessible, as expected. I opened a few of my files (images and pdfs) and they opened as expected.
Drive Letter
I opened Files and looked at the sidebar and "Google Drive" was there under "Cloud Drives".
I clicked on "Google Drive" and it opened my drive with all its contents viewable and accessible, as expected. I opened a few of my files (images and pdfs) and they opened as expected.
I also found that everything worked exactly the same if I had the entire old approach that uses the "root_preference_sqlite" file commented out. However, I did not want to commit it in this state because my testing was not especially thorough, but it might be worth looking into whether this will work now entirely without the old approach.