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

Picture with Whitesapce as Name Doesn't Load #32282

Open
thekief opened this issue Apr 22, 2024 · 10 comments
Open

Picture with Whitesapce as Name Doesn't Load #32282

thekief opened this issue Apr 22, 2024 · 10 comments

Comments

@thekief
Copy link

thekief commented Apr 22, 2024

Description:

I tend to paste images into RocketChat, which implicitly creates a pre-generated name. As I tend to avoid too long names, I shift + tab to get to the name field, replace it with a whitespace and hit enter

Steps to reproduce:

  1. Paste a picture into RC
  2. Replace the picture name with a whitespace
  3. Upload the Image
  4. Click on the picture preview

Expected behavior:

A click on the preview opens the picture.

Actual behavior:

When clicking on the picture, the load screen overlay pops up and it hangs there.

Server Setup Information:

  • Version of Rocket.Chat Server: 6.6
  • Operating System: n/a
  • Deployment Method: n/a
  • Number of Running Instances: n/a
  • DB Replicaset Oplog: n/a
  • NodeJS Version: n/a
  • MongoDB Version: n/a

Client Setup Information

  • Desktop App or Browser Version: Browser
  • Operating System: Linux

Additional context

This affects other OSes and the desktop app as well.

Relevant logs:

n/a

@kariem
Copy link

kariem commented Apr 23, 2024

For me, the default file name includes date and time, prefixed with "Clipboard". Just tried it out:

Clipboard - April 23, 2024 11:05:23.png

This is just too long.

I assume the actual string depends on the system that provides the clipboard information when pasting (paste event?)

For me as a user, it would also be ok to just have a reasonable placeholder for the file name when pasting an image from the clipboard (e.g. "clipboard", "pasted image").

Alternatively, it would also be ok to make file name optional and generate a random string when posting the message.

@SySagar
Copy link
Contributor

SySagar commented Apr 23, 2024

I am able to reproduce this bug. I think the default behivour should be that no white space should be allowed as naming. Will create a fix pr asap.

@thekief
Copy link
Author

thekief commented Apr 23, 2024

@SySagar please do not "fix" it like this. Your PR would merely address the symptom and not the underlying issue @kariem and me pointed out.

We replace the name, because the one auto-generated is

  • way too long,
  • and in addition contains whitespaces that are sometimes annoying to handle

The fix in my opinion should be either to allow empty names and correctly auto-generate IDs (e.g. <uuid>.png) or file names (eg. rc_<ISO date without delimeters>.png), or fix the underlying issue with the improper handling of a whitespace character.

I know this takes longer to address but the sole reason we have this issue is that we tried to find a workaround for an issue we have, which is the obnoxious file name.

@SySagar
Copy link
Contributor

SySagar commented Apr 23, 2024

ok so bascially there are few doubts of mine.
first when you paste an image directly on the rocket.chat it should show a pop up modal where you have to put the name and description. So how caome it is autogenerated.
second is that if suppose we are allowing the empty space only without any charactert then it simply means uploading an image with some description. becuase blank space it completely neglected for now.

@thekief
Copy link
Author

thekief commented Apr 23, 2024

I have absolutely no web dev experience, so take that with quite a big grain of salt

So how caome it is autogenerated

You could use a placeholder, which is used, if there is no value applied. A step further would be to drop the input form for the name altogether and autogenerate the name in the background.

second is that if suppose we are allowing the empty space only without any charactert then it simply means uploading an image with some description

I cannot follow you there. Why would I need a description? Why can't I have just a picture without anything?

@SySagar
Copy link
Contributor

SySagar commented Apr 24, 2024

Maybe I am misunderstanding here. Whenever you are directly pasting it should show this modal.
Capture

in this modal you have to fill the name of file and description. Also the name is dependent on the system file name.

@SySagar
Copy link
Contributor

SySagar commented Apr 24, 2024

I have absolutely no web dev experience, so take that with quite a big grain of salt

So how caome it is autogenerated

You could use a placeholder, which is used, if there is no value applied. A step further would be to drop the input form for the name altogether and autogenerate the name in the background.

second is that if suppose we are allowing the empty space only without any charactert then it simply means uploading an image with some description

I cannot follow you there. Why would I need a description? Why can't I have just a picture without anything?

Yes you can that is what I am suggesting it will default to if you don't provide any description and image/file name

@kariem
Copy link

kariem commented Apr 24, 2024

Chiming in here ...

I think the problem may not be that we cannot use " " as filename but that the defaults are not really helpful, if you just want to share a screenshot. Either you have a filename that you do not want to use or have to change the file name manually. @thekief followed the latter approach and ran into the issue described here.

Let's go back one step. This is what I see, when I paste an image in RocketChat web

image

I can now just click Send and everything is done.

However, I do not want the file name to be this long. I do not want the name to have a .png at the end and show the time and date when I took the screenshot. I don't even know why I need to have a filename. So, I have to navigate to the File name form field and think about a new name. Usually, I write "image" or "clipboard".

It's not a big problem, but then anyways, why does the form not have a reasonable default? If I remove the name, why isn't there a good default fallback?

Let's look at the thing we are using to discuss this. Here, in the GitHub Issues comment text area, I didn't even have to think about my screenshot. I pasted it from the clipboard and the editor will

  • upload the file
  • give it a label
  • paste some markdown into the comment text area
    ![image](https://github.com/RocketChat/Rocket.Chat/assets/459324/{id})
    

I do not have to do anything else, just paste the image.

How about making it as easy as that for someone who wants to paste into a RocketChat chat?

Suggestion

  • File name should be optional.
  • If I do not enter a name for the file, there will be a minimal reasonable default (e.g. image or clipboard)

In the context of this 'bug', I would suggest: if the user does not provide a file name in the form, we use image or some reasonable default for the file name.

This would be fine for me.

@SySagar
Copy link
Contributor

SySagar commented Apr 25, 2024

That sounds more natural and easier actually. So basically there are two cases we need to handle:

  1. If user dones't wants to give any name, it should show some default name.
  2. If user gives a name then it shouldn't be a space because that would eventaully mean no file name is mentioned.

If I am not wrong the while form will become redundant soon as new file upload design will be maintined soon. For now the fix sounds reasonable.

@reetp
Copy link

reetp commented May 8, 2024

It's not a big problem, but then anyways, why does the form not have a reasonable default?

Your "reasonable default" is not the same as mine, and that is the nub of the problem. I like mine time stamped. The length is no issue - I have loads of screen estate. It would be a pain to have to type the time out manually every time.... !

An 'option' might be a better route.

However, I do not want the file name to be this long. I do not want the name to have a .png at the end and show the time and date when I took the screenshot. I don't even know why I need to have a filename. So, I have to navigate to the File name form field and think about a new name. Usually, I write "image" or "clipboard".

You do not need to have .png or whatever, but you do need at least one character in the filename, currently.

Again, an option might work better than fixing it one way or another.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants