ipfs-webui icon indicating copy to clipboard operation
ipfs-webui copied to clipboard

Add file overwrite confirmation

Open rafaelramalho19 opened this issue 4 years ago • 9 comments

Whenever a file is moved to another folder, we don't check for the existence of a file with the same name & extension. Leading to potential unintentional overwriting.

To Reproduce Steps to reproduce the behavior:

  1. Have a /dogs/oof.png and /dogs/breeds/oof.png
  2. Drag the first one into the breeds folder
  3. No confirmation modal is being used

We should ensure issues in https://github.com/ipfs/ipfs-webui/issues/1667 are addressed when we solve this

rafaelramalho19 avatar Sep 04 '20 16:09 rafaelramalho19

Note: This can probably reuse overwrite modal from https://github.com/ipfs-shipyard/ipfs-webui/issues/1667.

jessicaschilling avatar Oct 07 '20 19:10 jessicaschilling

Proposed modal warnings to alleviate:

If only one file risks overwrite image

  • Icon is stroke_attention
  • Headline is Overwrite file?
  • Text is You already have a file named (funny-cat.gif) in this directory. Are you sure you want to overwrite it? This action is permanent and cannot be reversed.
  • Buttons are Overwrite and Cancel

If multiple files risk overwrite This one is just a first pass at conveying concepts, and would appreciate feedback from @lidel and @rafaelramalho19. Note that this approach doesn't give an option for iterating though the n files that would be overwritten and making a decision one by one -- it's an all-or-nothing. Would prefer the option to iterate, but don't want to block progress in order to create a more comprehensive solution. image

jessicaschilling avatar Oct 07 '20 20:10 jessicaschilling

  • I like both, but the first one is more useful because it shows the name of a conflicting item.
    • I think we iterate anyway? each item is copied separately via ipfs files cp
  • It may be safer to use item instead of file – we could use the same text for files and directories instead of having two sets of strings. I believe we use "item" in other places already.
  • We will not display this dialog if the destination has the same name AND CID, so it may be useful to highlight that we ask user for decision because the underlying CID is different
    • Perhaps something like You already have an item named (funny-cat.gif) in this directory and it points at a different CID. ?

lidel avatar Oct 13 '20 21:10 lidel

@lidel So is correct that, if we are iterating and copying files separately, we'd never run into a circumstance like the one in the second screenshot? (That's awkward if someone drags 5000000000 files and 1/10 of those are same-named, but a subject for another issue.)

Good call on those other two points. LMK about the iteration thing and I can provide updated screenshots as necessary.

jessicaschilling avatar Oct 13 '20 21:10 jessicaschilling

Correct. Code at files/actions.js#L282-L292 copies to proper MFS path after successful add. This because we want the same CID as in CLI (details in https://github.com/ipfs-shipyard/ipfs-webui/issues/676).

So we won't have use for the second screenshot.


I've been thinking about user interaction here and Overwrite-or-Cancel may be annoying if user does not mind fixing filenames later on their own. Appending CID to the filename could be a viable strategy for some users.

What if the first screenshot is augumented with additional button that provides less invasive resolution?

  • Cancel – aborts the operation
  • (needs name) – appends CID at the end of filename, so there is no conflict
  • Overwrite – overwrites destination with new CID

lidel avatar Oct 14 '20 12:10 lidel

@lidel How about ...

image

  • Icon is stroke_attention
  • Headline is Duplicate item name
  • Text (note italics for item name) is The destination directory already contains an item named (funny-cat.gif), but with a different CID. Do you want to overwrite the item in the destination directory, or rename the item you're moving by adding the last 4 characters of its CID to its name?
  • Buttons are Cancel, Rename, and Overwrite

jessicaschilling avatar Oct 15 '20 21:10 jessicaschilling

LGTM! small nits:

  • Can we make item name more prominent?
    • Idea: if we use the same bold font as Duplicate item name text, then it will make is super easy to eyeball without reading entire text :)
  • Small worry: Rename may suggest that clicking on it will ask for alternative name (people only read buttons)
    • either we do that (instead of appending) or..
    • rename Rename (:upside_down_face:) to Make unique to avoid confusion?

lidel avatar Oct 21 '20 21:10 lidel

@lidel Once more, with feeling. I think "Append" as a button name should work for visual scanning purposes. If this works for you, I'll update the specs accordingly in this issue and the other two related ones ... LMK.

image

jessicaschilling avatar Oct 22 '20 20:10 jessicaschilling

@lidel was this feature ever merged, and if not, do we still want to do this?

SgtPooki avatar Jun 20 '22 20:06 SgtPooki