Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

{uid} cannot be used as hostname #182

Open
Netspider opened this issue Feb 27, 2020 · 6 comments
Open

{uid} cannot be used as hostname #182

Netspider opened this issue Feb 27, 2020 · 6 comments

Comments

@Netspider
Copy link

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.

@yrammos
Copy link

yrammos commented Apr 27, 2020

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

@yrammos
Copy link

yrammos commented Apr 27, 2020

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.

@Netspider
Copy link
Author

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

@nickvergessen
Copy link
Member

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

Do that should really work

@Netspider
Copy link
Author

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

@nickvergessen
Copy link
Member

I guess this is blocking it:

if (filter_var($url, FILTER_VALIDATE_URL) === false ||
(strpos($url, 'http://') !== 0
&& strpos($url, 'https://') !== 0
&& strpos($url, 'mailto:') !== 0)) {
throw new InvalidURLException();
}

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants