Unable to paste image into editor - JavaScript error in console (Chromium). #7817

Closed
opened 2025-11-02 07:37:43 -06:00 by GiteaMirror · 16 comments
Owner

Originally created by @chriseaton on GitHub (Sep 8, 2021).

  • Gitea version (or commit ref): 1.15.2
  • Git version: 2.26.2
  • Operating system: CentOS 7 kv 3.10.0
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
  • Log gist:
Uncaught (in promise) TypeError: Cannot read property 'name' of null
    at HTMLFormElement.<anonymous> (index.js?v=df8c3cd2bb3da0431caef0f9f7d44357:35)
    at Generator.next (<anonymous>)
    at index.js?v=df8c3cd2bb3da0431caef0f9f7d44357:35
    at new Promise (<anonymous>)
    at ur (index.js?v=df8c3cd2bb3da0431caef0f9f7d44357:35)
    at HTMLTextAreaElement.<anonymous> (index.js?v=df8c3cd2bb3da0431caef0f9f7d44357:35)

Description

Take a screenshot to the clipboard, attempt to paste into the editor via CTRL+V, and the above error occurs.
Drag & drop still works. Issue appears in the latest Chromium-based browser. Firefox works fine. My desktop is gnome linux.

Screenshots

ss

Originally created by @chriseaton on GitHub (Sep 8, 2021). <!-- NOTE: If your issue is a security concern, please send an email to security@gitea.io instead of opening a public issue --> <!-- 1. Please speak English, this is the language all maintainers can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/gitea) or forum (https://discourse.gitea.io). 3. Please take a moment to check that your issue doesn't already exist. 4. Make sure it's not mentioned in the FAQ (https://docs.gitea.io/en-us/faq) 5. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> - Gitea version (or commit ref): 1.15.2 - Git version: 2.26.2 - Operating system: CentOS 7 kv 3.10.0 - Database (use `[x]`): - [x] PostgreSQL - [ ] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [x] Yes (provide example URL) - [ ] No - Log gist: ``` Uncaught (in promise) TypeError: Cannot read property 'name' of null at HTMLFormElement.<anonymous> (index.js?v=df8c3cd2bb3da0431caef0f9f7d44357:35) at Generator.next (<anonymous>) at index.js?v=df8c3cd2bb3da0431caef0f9f7d44357:35 at new Promise (<anonymous>) at ur (index.js?v=df8c3cd2bb3da0431caef0f9f7d44357:35) at HTMLTextAreaElement.<anonymous> (index.js?v=df8c3cd2bb3da0431caef0f9f7d44357:35) ``` ## Description Take a screenshot to the clipboard, attempt to paste into the editor via CTRL+V, and the above error occurs. Drag & drop still works. Issue appears in the latest Chromium-based browser. Firefox works fine. My desktop is gnome linux. ## Screenshots ![ss](https://user-images.githubusercontent.com/5247568/132428127-d716504f-4890-499e-8758-f7c86be62e36.png)
Author
Owner

@lunny commented on GitHub (Sep 8, 2021):

Could you try force refresh the page and try again?

@lunny commented on GitHub (Sep 8, 2021): Could you try force refresh the page and try again?
Author
Owner

@trepmag commented on GitHub (Sep 9, 2021):

Hello, noticed this also with 1.15.2 and also with 1.16.0+dev-221-gcd78c30fd at https://try.gitea.io/; also after page refresh (ctrl-shift r).

@trepmag commented on GitHub (Sep 9, 2021): Hello, noticed this also with 1.15.2 and also with 1.16.0+dev-221-gcd78c30fd at https://try.gitea.io/; also after page refresh (ctrl-shift r).
Author
Owner

@chriseaton commented on GitHub (Sep 9, 2021):

It still happens regardless of page refresh.

@chriseaton commented on GitHub (Sep 9, 2021): It still happens regardless of page refresh.
Author
Owner

@ryshi commented on GitHub (Sep 14, 2021):

I got the same problem with v1.15.2 and 1.16.0+dev-239-g04b233e94 at https://try.gitea.io/ was fixed

@ryshi commented on GitHub (Sep 14, 2021): I got the same problem with v1.15.2 and 1.16.0+dev-239-g04b233e94 at https://try.gitea.io/ was fixed
Author
Owner

@chriseaton commented on GitHub (Sep 29, 2021):

This is not fixed in try.gitea.io. See screenshot below showing my attempts to paste an image into the editor resulting in the error.

image

@chriseaton commented on GitHub (Sep 29, 2021): This is **_not_** fixed in try.gitea.io. See screenshot below showing my attempts to paste an image into the editor resulting in the error. ![image](https://user-images.githubusercontent.com/5247568/135312043-087e5cd0-6dec-4ff7-9464-1d302fb90f39.png)
Author
Owner

@ryshi commented on GitHub (Dec 7, 2021):

tested on https://try.gitea.io/ (ver 1.16.0+dev-661-geb69c7ec8), all goes fine
pic

but v1.15.7 got some problem

Screen Shot 2021-12-07 at 09 51 28

Screen Shot 2021-12-07 at 09 52 59

@ryshi commented on GitHub (Dec 7, 2021): tested on https://try.gitea.io/ (ver 1.16.0+dev-661-geb69c7ec8), all goes fine ![pic](https://user-images.githubusercontent.com/1818419/144951228-5930e87b-210e-4b5d-b90b-972606d4140d.png) but v1.15.7 got some problem ![Screen Shot 2021-12-07 at 09 51 28](https://user-images.githubusercontent.com/1818419/144951681-fb7ee0d8-6b61-4020-90a8-1822191ca2c5.png) ![Screen Shot 2021-12-07 at 09 52 59](https://user-images.githubusercontent.com/1818419/144951692-1acdcd24-7fce-4046-a59c-0bc0df4d9cee.png)
Author
Owner

@wxiaoguang commented on GitHub (Dec 7, 2021):

@ryshi the problem you met is not related to this issue.

In your screenshot, we can see an incorrect URL /test/issues/undefined, it seems that Gitea can not find the correct backend URL to do the uploading.

@wxiaoguang commented on GitHub (Dec 7, 2021): @ryshi the problem you met is not related to this issue. In your screenshot, we can see an incorrect URL `/test/issues/undefined`, it seems that Gitea can not find the correct backend URL to do the uploading.
Author
Owner

@wxiaoguang commented on GitHub (Dec 7, 2021):

@chriseaton it seems that only you can reproduce the problem (I can not either).

Can you show the source code around the error? TBH, I have no idea how to debug this problem without reproducible steps on my side ....

@wxiaoguang commented on GitHub (Dec 7, 2021): @chriseaton it seems that only you can reproduce the problem (I can not either). Can you show the source code around the error? TBH, I have no idea how to debug this problem without reproducible steps on my side ....
Author
Owner

@ryshi commented on GitHub (Dec 7, 2021):

Hi @wxiaoguang , I met the problem 'Unable to paste image into editor' but can not tell why and how it happened.
I got the same error message like what @chriseaton got at the beginning (ver 1.15.2) but message changed for now (ver 1.15.7). Should I create a new issue or keep going here ?
Thanks for helping.

@ryshi the problem you met is not related to this issue.

In your screenshot, we can see an incorrect URL /test/issues/undefined, it seems that Gitea can not find the correct backend URL to do the uploading.

@ryshi commented on GitHub (Dec 7, 2021): Hi @wxiaoguang , I met the problem 'Unable to paste image into editor' but can not tell why and how it happened. I got the same error message like what @chriseaton got at the beginning (ver 1.15.2) but message changed for now (ver 1.15.7). Should I create a new issue or keep going here ? Thanks for helping. > @ryshi the problem you met is not related to this issue. > > In your screenshot, we can see an incorrect URL `/test/issues/undefined`, it seems that Gitea can not find the correct backend URL to do the uploading.
Author
Owner

@wxiaoguang commented on GitHub (Dec 7, 2021):

Can you try 1.16? 1.16 has been frozen (prepare to release) and I have been using 1.16 in production for a while.

@wxiaoguang commented on GitHub (Dec 7, 2021): Can you try 1.16? 1.16 has been frozen (prepare to release) and I have been using 1.16 in production for a while.
Author
Owner

@ryshi commented on GitHub (Dec 7, 2021):

BTW, I compiled from source by 'GO111MODULE=on GOOS=linux GOARCH=amd64 TAGS="bindata" make generate build' for CentOS 6. I'll try 1.15.7 release directly first

It works on release version , it's all done for me. Thanks.
image

@ryshi commented on GitHub (Dec 7, 2021): BTW, I compiled from source by 'GO111MODULE=on GOOS=linux GOARCH=amd64 TAGS="bindata" make generate build' for CentOS 6. I'll try 1.15.7 release directly first It works on release version , it's all done for me. Thanks. ![image](https://user-images.githubusercontent.com/1818419/144971550-c4fa18b3-7691-4ff3-b2e9-fc30a3cf5135.png)
Author
Owner

@wxiaoguang commented on GitHub (Dec 7, 2021):

If you compile it by yourself, then you should know how to debug it. Otherwise it's always recommended to use official releases.

@wxiaoguang commented on GitHub (Dec 7, 2021): If you compile it by yourself, then you should know how to debug it. Otherwise it's always recommended to use official releases.
Author
Owner

@ryshi commented on GitHub (Dec 7, 2021):

There is no release for CentOS 6 , so I did some google work and found a way out.

@ryshi commented on GitHub (Dec 7, 2021): There is no release for CentOS 6 , so I did some google work and found a way out.
Author
Owner

@chriseaton commented on GitHub (Dec 7, 2021):

I dug in a while back and found something in code where it's checking the clipboard data and assuming there is a name property on the pasted image data - but in certain clipboard situations with image data I noticed the browser did not populate the name if the image was copied from a non-file source (such as copied from an app that set the clipboard data, or a selection of an image) - thus the null reference error.

@chriseaton commented on GitHub (Dec 7, 2021): I dug in a while back and found something in code where it's checking the clipboard data and assuming there is a `name` property on the pasted image data - but in certain clipboard situations with image data I noticed the browser did not populate the `name` if the image was copied from a non-file source (such as copied from an app that set the clipboard data, or a selection of an image) - thus the null reference error.
Author
Owner

@chriseaton commented on GitHub (Dec 7, 2021):

This was resolved for me though in a recent release after upgrading. I no longer can produce the error.

@chriseaton commented on GitHub (Dec 7, 2021): This was resolved for me though in a recent release after upgrading. I no longer can produce the error.
Author
Owner

@wxiaoguang commented on GitHub (Dec 7, 2021):

Thanks, it is really very helpful. Maybe this is an upstream bug (Gitea's JS packages got upgraded in new releases)

@wxiaoguang commented on GitHub (Dec 7, 2021): Thanks, it is really very helpful. Maybe this is an upstream bug (Gitea's JS packages got upgraded in new releases)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#7817