{uid} cannot be used as hostname
Steps to reproduce
- set the hostname of the external site to "https://{uid}/"
- 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.
Confirming the problem also whenever {uid} is passed as a GET URL parameter, as in example.org/?user={uid}.
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.
I wanted https://webmail.{uid}/ so there is no localhost involved.
But we replace it in the full URL https://github.com/nextcloud/external/blob/master/lib/SitesManager.php#L110
Do that should really work
but the javascript does not allow this syntax, it draws a red border around the url field and does not save.
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.