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

Paperboy overwrites files with duplicate names #6

Open
xldenis opened this issue Jun 19, 2018 · 11 comments
Open

Paperboy overwrites files with duplicate names #6

xldenis opened this issue Jun 19, 2018 · 11 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@xldenis
Copy link

xldenis commented Jun 19, 2018

If you accept the name suggestion from paperboy, it will happily overwrite any files that happen to have that name in the library folder. Luckily in this case it was overwriting another copy of the same paper but it would be nice to have overwrite safeguards.

Reproduction:

  1. Create multiple copies of a pdf in Inbox folder
  2. Move them to library with the same name
  3. Watch duplicates vanish 😱.
@2mol 2mol added enhancement New feature or request good first issue Good for newcomers labels Jun 19, 2018
@2mol
Copy link
Owner

2mol commented Jun 19, 2018

That's true, right now paperboy doesn't care, but we can definitely put in a little check. If you happen to be interested in contributing I can walk you through the code to find the right place to integrate this.

@xldenis
Copy link
Author

xldenis commented Jun 19, 2018

Sure! I'd be happy to add a quick feature like this.

@xldenis
Copy link
Author

xldenis commented Jun 19, 2018

So I've identified the place the changes need to be made, but before I go ahead with some changes, do you have an error mechanism in mind? Exceptions or ExceptT IO or ... ?

@2mol
Copy link
Owner

2mol commented Jun 20, 2018

Great! If you have a preference then feel free to choose. But if you are not sure, then I was thinking to change the return of

fileFile :: Config -> FilePath -> Text -> IO ()

into something like -> IO (Either FilingErr ()) so that we can display a prompt that allows to overwrite the file or cancel the action.

But that's just me keeping it stupid simple and exception free, if you have more experience with idiomatic handling of these things, then I'm happy to learn about those.

I guess the question is if we want to also catch errors about non-existing directories, file system errors and whatever else can happen. What about crazy scenarios where I manually move/delete the file while I'm renaming it. Not sure I care enough about that scenario, but it might pay off thinking about the edge cases.

@no-identd
Copy link

@xldenis do you still work on this?

@xldenis
Copy link
Author

xldenis commented Apr 22, 2019

No, I completely forgot about this!! Go ahead and take over.

@no-identd
Copy link

Unfortunately I lack the time to do so, sorry :(

@2mol
Copy link
Owner

2mol commented Apr 26, 2019

It will make it into a future version, no worries. I'm basically just waiting until I figure out a slightly easier way to create little popups (because we need a confirm/cancel dialog in this case). Right now with the way I do it, it's a bit annoying to create a dialog, so I have to learn more brick.

@sureyeaah
Copy link

Hi I would like to work on this :)

@2mol
Copy link
Owner

2mol commented Apr 28, 2020

Hi I would like to work on this :)

Hi Shaurya! You're very welcome to hack on this, do you need help or do you just want to send me an initial PR with the suggested code?

@sureyeaah
Copy link

sureyeaah commented Apr 29, 2020

Sure I can send a PR. Need to check how to handle dialog box.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants