Skip to content
This repository has been archived by the owner on Nov 20, 2023. It is now read-only.

Duplicate counts and write to file #92

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

adoreparler
Copy link

Added functionality to count how many files were reported as duplicates after attempting to upload to the server. Added functionality to write those duplicate file names to a file

…es after attempting to upload to the server. Added functionality to write those duplicate file names to a file
@adoreparler
Copy link
Author

dupes

bin/index.ts Outdated
if (res.data && res.data.duplicate) {
const filePathSplit = asset.filePath.split('/');
duplicates.push(filePathSplit[filePathSplit.length-1]);
return;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This return probably breaks the album feature. I think it would work fine without the return.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I returned there because I did not want it to delete local asset and was not sure if it should proceed with anything else if it is a duplicate. Let me know your thoughts

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if they set delete to true it should delete the files when they've been backed up to the server.

It probably doesn't make sense to log the output of duplicates when delete is used though.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have feelings against deleting the asset if its identified as a duplicate. I feel like it technically has not been backed up to the server and should not be deleted. Its either already on there or like in my case google created a bunch of duplicates of the same file and it matched to the original that was uploaded. Logging these cases out so that investigation can happen I feel is what I would want at least. I can remove the return and disable the delete if duplicate, or just remove the return and let it delete.

I'll let you make the decision.

Copy link
Contributor

@jrasm91 jrasm91 Jun 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only situation that can cause duplicate: true is if the file, byte for byte, exists exactly on the server. I personally never use the CLI with the delete option, so I don't really care one way or the other, but I would expect it to delete it (which is what it does today btw - this is existing functionality).

bin/index.ts Outdated Show resolved Hide resolved
bin/index.ts Outdated Show resolved Hide resolved
…es if the delete flag is added. Added assumeYes to the question if they want to create a duplicates file, if the flag is present. Change the output to the duplicates file to be the full file path
@adoreparler
Copy link
Author

Commit added, not sure if I need to do anything in this pull request to get them to be added. They show in the commits list.

Copy link
Contributor

@jrasm91 jrasm91 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I like write some of the output to a file as that is easier to review afterwards. I would honestly love it for the error assets as well. Maybe that can be a future PR.

bin/index.ts Outdated Show resolved Hide resolved
bin/index.ts Outdated Show resolved Hide resolved
adoreparler and others added 2 commits June 8, 2023 11:22
Fix type

Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants