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

Two file names shown when using both file picker & drag/drop #318

Closed
rugk opened this issue May 21, 2018 · 4 comments
Closed

Two file names shown when using both file picker & drag/drop #318

rugk opened this issue May 21, 2018 · 4 comments

Comments

@rugk
Copy link
Member

rugk commented May 21, 2018

#315 (comment)

@elrido elrido changed the title Two file names shopwn when using both file picker & drag/drop Two file names shown when using both file picker & drag/drop May 22, 2018
@r4sas
Copy link
Member

r4sas commented May 22, 2018

Way to reproduce:

  1. Select attachment with Browse button.
  2. Copy other file in filesystem or picture to buffer.
  3. Execute "paste" (Ctrl+V) command on PrivateBin page.

Result can be like this:
image
Uploaded will be file added by Drag'n'Drop/Pasted.

@r4sas
Copy link
Member

r4sas commented May 22, 2018

Can we use AttachmentViewer.removeAttachment with addDragDropHandler and addClipboardEventHandler ?
Or we must use $fileWrap.find('input').val(''); to clear Browse selection?

@rugk
Copy link
Member Author

rugk commented May 22, 2018

The drop handler is and should always be there, of course.

The issue is $fileWrap.find('input').val(''); is only possible for clearing the file picker. For security reasons, you cannot manualyl set a file name even there.
removeAttachment does something completely different if I remember (it's about the preview) correctly.

What we could do is hide the file picker completely if drag- and drop is done, but then you cannot select a different file with the file picker, afterwards.

@r4sas
Copy link
Member

r4sas commented May 22, 2018

I'm trying to suggest to clear the field of the selected file when adding a file from the buffer (like Remove attachment action before processing pasted file with readFileData function).

rugk added a commit that referenced this issue May 22, 2018
@rugk rugk closed this as completed May 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants