Skip to content

Fix adding x-requested-with header for relative URLs in some cases - #41632

Merged
julien-nc merged 2 commits into
masterfrom
fix/relative-url-x-requested-with
Nov 24, 2023
Merged

Fix adding x-requested-with header for relative URLs in some cases#41632
julien-nc merged 2 commits into
masterfrom
fix/relative-url-x-requested-with

Conversation

@julien-nc

Copy link
Copy Markdown
Member

When NC is at the root path of the web server, getRootUrl() returns an empty string and isNextcloudUrl() always returned true for relative URLs.

The condition to know if a URL points to NC is now:

  • the URL starts with the absolute NC base URL (this implicitly checks if the URL is absolute)
  • OR the URL is relative and start with NC's root URL (the sub path)

This broke the OpenStreetMap integration in instances that are accessible at the root of the webserver.

@julien-ncjulien-nc added bug 3. to review Waiting for reviews labels Nov 21, 2023
@julien-ncjulien-nc added this to the Nextcloud 28 milestone Nov 21, 2023
@julien-nc
julien-nc requested review from a team, emoral435, juliusknorr, skjnldsv and susnux and removed request for a teamNovember 21, 2023 10:05
@julien-nc
julien-ncforce-pushed the fix/relative-url-x-requested-with branch from 0e18a47 to 6b3e70cCompareNovember 21, 2023 10:09
@blizzzblizzz mentioned this pull request Nov 22, 2023
5 tasks

@emoral435emoral435 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me!

@blizzzblizzz modified the milestones: Nextcloud 28, Nextcloud 29Nov 23, 2023
@julien-nc
julien-ncforce-pushed the fix/relative-url-x-requested-with branch 2 times, most recently from aeac884 to 323b6f7CompareNovember 24, 2023 09:19
@julien-nc

Copy link
Copy Markdown
MemberAuthor

/backport to stable28

@julien-nc

Copy link
Copy Markdown
MemberAuthor

@juliushaertl@emoral435@susnux Cypress test failure seems unrelated (theming app). Can someone force merge this? 🙏

… URL is empty
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
@susnux
susnuxforce-pushed the fix/relative-url-x-requested-with branch from 8729f37 to 5d5572cCompareNovember 24, 2023 10:33
@julien-nc
julien-nc merged commit d3fa954 into masterNov 24, 2023
@julien-nc
julien-nc deleted the fix/relative-url-x-requested-with branch November 24, 2023 11:50
@julien-nc

Copy link
Copy Markdown
MemberAuthor

/backport to stable27

@julien-nc

Copy link
Copy Markdown
MemberAuthor

/backport to stable26

@julien-nc

Copy link
Copy Markdown
MemberAuthor

/backport to stable25

@skjnldsv

Copy link
Copy Markdown
Member

/skjnldsv-backport to stable27

@skjnldsv

Copy link
Copy Markdown
Member

/skjnldsv-backport to stable26

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to reviewWaiting for reviewsbug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@julien-nc@skjnldsv@juliusknorr@emoral435@blizzz