Open thekief opened 5 months ago
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.
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.
@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
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.
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.
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?
Maybe I am misunderstanding here. Whenever you are directly pasting it should show this modal.
in this modal you have to fill the name of file and description. Also the name is dependent on the system file name.
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
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
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
![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
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.
That sounds more natural and easier actually. So basically there are two cases we need to handle:
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.
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.
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 enterSteps to reproduce:
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:
Client Setup Information
Additional context
This affects other OSes and the desktop app as well.
Relevant logs:
n/a