Skip to content

Can't copy attachment link when accessing gitea not over HTTPS #26202

Closed
@OddMorning

Description

@OddMorning

Description

It's impossible to copy attachment link when accessing gitea over local network:

JavaScript error: Uncaught TypeError: Cannot read properties of undefined (reading 'writeText') (http://192.168.9.56:3000/assets/js/index.js?v=1.20.1 @ 54:4159).

It tries to copy text using navigator.clipboard.writeText(x) but navigator.clipboard is available only when url is either HTTPS or localhost.
There are workarounds for "insecure sources" such as document.execCommand('copy').
Or probably checking window.isSecureContext (which is true for both HTTPS and localhost) and showing a proper error message would be also fine.

Gitea Version

1.20.1

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

mstsc – 28 07 2023; 15 18 34

Git Version

No response

Operating System

No response

How are you running Gitea?

Running file gitea-1.20.1-windows-4.0-amd64.exe

Database

None

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions