Fix wikifying of root-relative links #330

Merged
matthijskooijman merged 2 commits from root-relative-links into master 2020-08-10 15:26:59 +00:00
matthijskooijman commented 2020-06-23 16:51:53 +00:00 (Migrated from github.com)

This makes sure that a link like /en/pagename is properly wikified too, rather than just en/pagename or https://domain.tld/en/pagename.

This makes sure that a link like `/en/pagename` is properly wikified too, rather than just `en/pagename` or `https://domain.tld/en/pagename`.
laurensmartina (Migrated from github.com) approved these changes 2020-08-10 14:09:31 +00:00
laurensmartina (Migrated from github.com) left a comment

Please check my comment.

Please check my comment.
laurensmartina (Migrated from github.com) commented 2020-08-10 14:07:49 +00:00

Could this lead to an issue if the site can be accessed through multiple domains?
eg. http(s)://(www.)mydomain.tld/path/en/pagename
https://www.mydomain.tld/path/en/pagename
http://www.mydomain.tld/path/en/pagename
https://mydomain.tld/path/en/pagename
http://mydomain.tld/path/en/pagename

Could this lead to an issue if the site can be accessed through multiple domains? eg. http(s)://(www.)mydomain.tld/path/en/pagename https://www.mydomain.tld/path/en/pagename http://www.mydomain.tld/path/en/pagename https://mydomain.tld/path/en/pagename http://mydomain.tld/path/en/pagename
matthijskooijman (Migrated from github.com) reviewed 2020-08-10 14:51:46 +00:00
matthijskooijman (Migrated from github.com) commented 2020-08-10 14:51:46 +00:00

Yes, it could. However, this is already the case with the current code (that part is not really changed, just refactored to use HyphaRequest::getRootUrl rather than global $hyphaUrl, I just split this commit into two to emphasize this).

Also, this is only a problem when someone externally adds a URL to another version (another equivalent domain or http vs https) of the site, since all urls internally generated use the same url as is removed here. IOW, once the url is made relative once, it gets stored in the database relatively properly, and is potentially expanded to an absolute URL when e.g. editing the page, but can then always be made relative again when saving.

Also, we cannot really fix this properly now: The PHP code has no idea about the different domains that the site is available under. The only way AFAICS to fix this is to configure these domains manually, which makes this a lot more complex. So I would leave this problem unsolved for now, certainly within this PR>

Yes, it could. However, this is already the case with the current code (that part is not really changed, just refactored to use `HyphaRequest::getRootUrl` rather than global `$hyphaUrl`, I just split this commit into two to emphasize this). Also, this is only a problem when someone externally adds a URL to another version (another equivalent domain or http vs https) of the site, since all urls internally generated use the same url as is removed here. IOW, once the url is made relative once, it gets stored in the database relatively properly, and is potentially expanded to an absolute URL when e.g. editing the page, but can then always be made relative again when saving. Also, we cannot really fix this properly now: The PHP code has no idea about the different domains that the site is available under. The only way AFAICS to fix this is to configure these domains manually, which makes this a lot more complex. So I would leave this problem unsolved for now, certainly within this PR>
matthijskooijman commented 2020-08-10 14:53:41 +00:00 (Migrated from github.com)

I rebased on top of master and split the last commit in two. The first commit has disappeared, since it was already merged in another PR. I would think this is ready to merge now.

I rebased on top of master and split the last commit in two. The first commit has disappeared, since it was already merged in another PR. I would think this is ready to merge now.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
harmen/hypha!330
No description provided.