external icon indicating copy to clipboard operation
external copied to clipboard

{uid} cannot be used as hostname

Open Netspider opened this issue 5 years ago • 6 comments

Steps to reproduce

  1. set the hostname of the external site to "https://{uid}/"
  2. press [Enter]

Expected behaviour

hostname field should get a green border and save

Actual behaviour

hostname field has a red border and is not saved

Server configuration

PHP version: 7.4 Nextcloud version: (see Nextcloud admin page) 18.0.1 List of activated apps: external 3.5.0

"https://example.org/{uid}" is working, but not if the variable is used in the hostname part like above.

Netspider avatar Feb 27 '20 08:02 Netspider

Confirming the problem also whenever {uid} is passed as a GET URL parameter, as in example.org/?user={uid}.

yrammos avatar Apr 27 '20 16:04 yrammos

UPDATE: In fact it does work. Might it be that you're referring to the external site with a localhost URL? This was the cause of the error in my case. Replacing with a truly external URL resolved it.

yrammos avatar Apr 27 '20 16:04 yrammos

I wanted https://webmail.{uid}/ so there is no localhost involved.

Netspider avatar Apr 27 '20 16:04 Netspider

But we replace it in the full URL https://github.com/nextcloud/external/blob/master/lib/SitesManager.php#L110

Do that should really work

nickvergessen avatar Apr 27 '20 17:04 nickvergessen

but the javascript does not allow this syntax, it draws a red border around the url field and does not save.

Netspider avatar Apr 27 '20 19:04 Netspider

I guess this is blocking it: https://github.com/nextcloud/external/blob/e4e5f93733596cf948b07a810e25d09717a9c0a0/lib/SitesManager.php#L222-L227

We need to do the replacements with the values of the current admin before checking if the URL is valid.

nickvergessen avatar May 04 '20 09:05 nickvergessen