Skip to content

Conversation

@susnux
Copy link
Contributor

@susnux susnux commented Sep 10, 2024

Summary

We basically mock the way URLGenerator::getAbsoluteURL works, so we must make sure that the URL might already contain the webroot. Because baseURL and cliURL also contain the webroot we need to remove the webroot from the URL first.

Checklist

@susnux susnux added this to the Nextcloud 31 milestone Sep 10, 2024
@susnux susnux requested review from come-nc and kesselb September 10, 2024 23:22
@susnux
Copy link
Contributor Author

susnux commented Sep 10, 2024

/backport to stable30

@kesselb

This comment was marked as resolved.

@susnux

This comment was marked as resolved.

@kesselb

This comment was marked as resolved.

@susnux

This comment was marked as resolved.

@kesselb

This comment was marked as resolved.

@susnux

This comment was marked as resolved.

@kesselb
Copy link
Contributor

kesselb commented Sep 11, 2024

Too many forward slashes for me 🙈

@kesselb
Copy link
Contributor

kesselb commented Sep 11, 2024

/backport to stable29

Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Psalm found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

@susnux susnux requested a review from come-nc September 12, 2024 18:51
Copy link
Contributor

@come-nc come-nc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think fixing the wrong type in the phpdoc should fix psalm errors.
Nice job 👍

@come-nc
Copy link
Contributor

come-nc commented Sep 13, 2024

phpunit tests also need to be adapted to change from getSystemValue to getSystemValueString

if ($removeWebroot) {
$segments = parse_url($url);
$port = isset($segments['port']) ? (':' . $segments['port']) : '';
return $segments['scheme'] . '://' . $segments['host'] . $port;

Check notice

Code scanning / Psalm

PossiblyUndefinedArrayOffset

Possibly undefined array key $segments['scheme'] on array{fragment?: string, host?: string, pass?: string, path?: string, port?: int, query?: string, scheme?: string, user?: string}|false
if ($removeWebroot) {
$segments = parse_url($url);
$port = isset($segments['port']) ? (':' . $segments['port']) : '';
return $segments['scheme'] . '://' . $segments['host'] . $port;

Check notice

Code scanning / Psalm

PossiblyUndefinedArrayOffset

Possibly undefined array key $segments['host'] on array{fragment?: string, host?: string, pass?: string, path?: string, port?: int, query?: string, scheme?: string, user?: string}|false
susnux and others added 2 commits September 13, 2024 13:06
We basically mock the way `URLGenerator::getAbsoluteURL` works,
so we must make sure that the URL might already contain the webroot.
Because `baseURL` and `cliURL` also contain the webroot we need to remove
the webroot from the URL first.

Co-authored-by: Ferdinand Thiessen <[email protected]>
Co-authored-by: Daniel <[email protected]>
Signed-off-by: Ferdinand Thiessen <[email protected]>
… path

Co-authored-by: Ferdinand Thiessen <[email protected]>
Co-authored-by: Côme Chilliet <[email protected]>
Signed-off-by: Ferdinand Thiessen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Security & setup warnings when Nextcloud is in subdirectory [Bug]: NC29 .well-known URLs, failed on: /.well-known/caldav

5 participants