Skip to content

Links to non-inline-image attachments broken #677

@jrarmstro

Description

@jrarmstro

What happened?

When attempting to link to an attachment that is not an inline image, the resulting link is incorrect.

What did you expect to happen?

A link to an Attachment should point to the attachment correctly.

How can we reproduce the behavior you experienced?

Run mark for the following file

<!-- Title: Example -->
<!-- Attachment: examples/example.yaml -->

# Test

[Example](examples/example.yaml)
$ mark --base-url "https://redacted.atlassian.net/wiki" --space "~123456789" -f ./README.md
2025-11-12 14:14:50.291 INFO  processing README.md
2025-11-12 14:14:51.537 INFO  page will be stored under path: Overview > Example
2025-11-12 14:14:51.782 INFO  keeping unmodified attachment: "examples/example.yaml"
2025-11-12 14:14:51.782 WARN  unused attachment: examples/example.yaml
2025-11-12 14:14:53.015 INFO  page successfully updated: https://redacted.atlassian.net/wiki/spaces/~123456789/pages/987654321/Example
https://redacted.atlassian.net/wiki/spaces/~123456789/pages/987654321/Example

The resulting link to Example is actually a link to some other page in the space, which we can also see in the dry run output:

$ mark --dry-run --base-url "https://redacted.atlassian.net/wiki" --space "~123456789" -f ./README.md
2025-11-12 14:16:21.519 INFO  processing README.md
2025-11-12 14:16:23.516 INFO  page will be stored under path: Overview > Example
<h1 id="Test">Test</h1>
<p><a href="/wiki/spaces/~123456789/overview">Example</a></p>

This example is in my "personal" space in Confluence, but the same behaviour is observed in other spaces.

Further Information (please complete the following information)

  • Mark Version: v15.0.0
  • Confluence Hosting: Cloud
  • Environment specific Information: macOS

Additional context

When link.go resolves page metadata the resolved linkMeta.Title appears to be empty when I added some additional debugging:

fmt.Println("extracted link metadata:", "space=", linkMeta.Space, "title=", linkMeta.Title)

> extracted link metadata: space= [redacted] title= 

Preventing link.go from trying to getConfluenceLink when linkMeta.Title == "" seems to resolve the problem:

		if linkMeta.Title == "" {
			return "", nil
		}

Dry run leaves the link in place (rather than linking to some unrelated page in the space):

$ mark --dry-run --base-url "https://redacted.atlassian.net/wiki" --space "~123456789" -f ./README.md
2025-11-12 14:24:05.939 INFO  processing README.md
2025-11-12 14:24:07.311 INFO  page will be stored under path: Overview > Example
<h1 id="Test">Test</h1>
<p><a href="examples/example.yaml">Example</a></p>

And a non-dry-run provides the expected link to the attachment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions