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

Accessing page links through a different URL than base-url fails #456

Closed
monti-python opened this issue Jun 14, 2024 · 8 comments
Closed
Labels

Comments

@monti-python
Copy link
Contributor

What happened?

In our company we access the same Confluence instance through different domains depending on the authentication scheme. However, mark hardcodes the entire URL (including the base-url) whenever a Confluence page from the same instance is referenced via relative paths, creating a hard reference to the base-url that was specified at the time mark was invoked.

This can be fixed by removing the hardcoded reference to base-url as Confluence supports relative links to refer to pages under the same Confluence instance.

This would also make the pages and links independent from the current base-url in general, allowing for more flexibility.

What did you expect to happen?

Links to Confluence pages within the same page should always work regardless of the Confluence's hostname/domain.

How can we reproduce the behavior you experienced?

Steps to reproduce the behavior:

  1. Create a page referencing a relative file containing another page, e.g.:

    <!-- Title: PageWithRef -->
    
    See this [page](../path/to/other/page.md)
  2. Create a DNS alias for your Confluence instance

  3. Deploy the page above using the new alias as base-url

  4. Observe how the references above points to the new base-url (DNS alias), even in the regular URL

Further Information (please complete the following information)

  • Mark Version (mark --version): 9.12.0
@monti-python
Copy link
Contributor Author

Created a PR to solve it: #457

@monti-python
Copy link
Contributor Author

Solved in #457

@monti-python
Copy link
Contributor Author

Reopening due to #468 #469

@monti-python
Copy link
Contributor Author

monti-python commented Jul 25, 2024

@mrueg @st-karol As a simple mechanism to form relative links we could simply extract the path from the base_url, e.g.:

link = url.Parse(api.BaseURL).Path + page.Links.Full

That should be robust enough to handle both Confluence Cloud (with the /wiki subpath) and Confluence Server (without a subpath), assuming base_url includes the /wiki subpath for Confluence Cloud.

What do you think?

@monti-python monti-python changed the title Accessing page links through a different URL as the base-url fails Accessing page links through a different URL than the base-url fails Jul 25, 2024
@monti-python monti-python changed the title Accessing page links through a different URL than the base-url fails Accessing page links through a different URL than base-url fails Jul 25, 2024
@st-karol
Copy link

@monti-python

	if page != nil {
		var path, err = url.Parse(api.BaseURL)
		if nil == err {
			link = path.Path + page.Links.Full
		}
	}

Works perfectly fine in our case (cloud). Correct relative link is generated 💥 Go for it if that works with your setup as well 🙇

@mrueg
Copy link
Collaborator

mrueg commented Jul 26, 2024

Sure, feel free to propose the suggestion as a PR!

@monti-python
Copy link
Contributor Author

@st-karol it'd be great if you could have a look at #477 as well 🙏

@mrueg
Copy link
Collaborator

mrueg commented Sep 9, 2024

Closing as #477 has been merged. Thanks for your contribution!

@mrueg mrueg closed this as completed Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants