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

When Target Folder is unspecified, Drive file must be allowed to reside in any folder. #14

Closed
feelnrg opened this issue Sep 14, 2020 · 4 comments
Labels
bug Something isn't working

Comments

@feelnrg
Copy link

feelnrg commented Sep 14, 2020

Hello,

first of all thank you very much for your work.

My Keepass File is stored in a Subfolder in Drive : Keepass\Database\KeepassFile.kdbx
Now if sync with Drive, the file will be created in the root folder. I think the old plugin was checking if the filename is present and then sync. I was able to move the file where ever I want and had no problems for sync. I have tried to set the Target Sync Folder in the options but it is not possible to set a Subfolder like Keepass\Database. How can we solve this issue? Maybe it is possible to check first if target file is present on Drive and assume its folder structure. Otherwise the plugin creates a second file (with the same name) in the root folder and after then the snyc does not work for other clients because the file exists twice.

Thank you.

@walterpg
Copy link
Owner

I think the old plugin would look for any Drive file, in any folder. If the file had the same name as the Windows database file it would sync to it. But what if multiple files with the target name are organized in separate folders, say, for change management? Which one should it use?

Personally, with respect to file locations, I think the plugin should treat Drive like a conventional hierarchical file system if possible, to avoid user errors and duplication. What do you think?

But anyway, the current plugin's "top-level or root folder only" limitation is arbitrary. The main limiting factor is the programmer's novice status with the Drive API. It is certainly possible to target any folder, regardless of nested-folder depth, with the API. Would this be useful?

The "add a shortcut" feature of Drive allows you to "link" one file to multiple folders without duplication, and so it may be a workaround for you until there is a general solution.

Thanks for this observation and your kind words.

@feelnrg
Copy link
Author

feelnrg commented Sep 21, 2020

It would be very nice, if the plugin also look in any folder if the file exists. For basic setup I think there shouldn't be a duplicate file with the same name. Otherwise you must be sure to set the right folder for any device you are using. If root folder was set in the plugin as default and your file was in another folder before, then it will sync without noticeably issue for the user but while syncing from other devices which will use the file which is in another folder, you will loose some information because you have synced to the root folder before. I think best practice and for those people who are not care about any folder structures should be like I described: The plugin should look for that file first if it exist anywhere and avoid double files. By the way if you do not have any file with the same name in your drive, the plugin will sync it to the root folder. But also if the user move the file in another folder, the plugin will keep working without any issues, because it will always sync to the right file.

Of course It would be also possible to to specify the subfolder in the plugin. But if you change or move the folder in Drive, you have to configure the plugin again. For this behavior I can not see any advantage to have seperate files with the same name in different folders.

I would suggest following workflow for basic setup when target folder field in plugin is blank:

Check if file with same name exists
If yes >>> use its folder structure and do not create second file with the same name.
if not >>> create file in root folder

By the way, I have created a shortcut from the file (which is in a sub folder) to the root folder. But while syncing the plugin gives an error message:

grafik

Thank you for your effort 👍

@walterpg
Copy link
Owner

Thanks for the response. You have convincing arguments that this is a regression:

  • The old plugin will sync to a Drive file with the name of the KP database file, regardless of its parent folder(s) on Drive; if more than one file with that name exists anywhere on Drive, sync ops fail with "duplicate" error. The parent folder default is "root" when the Drive file does not yet exist.
  • The new plugin requires the Drive file to be in a designated location (the root folder or a subfolder) due to the introduction of the "Target Folder" feature; if more than one file exists in that location, sync ops fail with "duplicate" error. If unspecified, the designated folder is "root".

We can resolve this by retaining the former behavior when a Target Folder is not specified, and the latter only when a Target Folder is specified.

And then there may be two other outstanding issues that effect Target Folders:

  • Target folder specification should allow arbitrary "depth", rather than only top-level folders.
  • Drive shortcuts should be supported.

I'll enter new issues for these later.

@walterpg walterpg changed the title Target Folder (Subfolders) in Drive When Target Folder is unspecified, Drive file must be allowed to reside in any folder. Sep 21, 2020
@walterpg walterpg added the bug Something isn't working label Sep 21, 2020
@feelnrg
Copy link
Author

feelnrg commented Sep 22, 2020

Hi, here is the error message when using old plugin and new plugin on different PC's

grafik

@walterpg walterpg pinned this issue Sep 24, 2020
walterpg added a commit that referenced this issue Sep 25, 2020
Leave folder out of query if not specified.  Update text and labels to
reflect no-folder semantics. (issue #14)
@walterpg walterpg unpinned this issue Oct 5, 2020
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