Skip to content

fix: correct history link handling in the library UI#1667

Open
bcullman wants to merge 1 commit intoOctopusDeploy:masterfrom
bcullman:fix-history-link
Open

fix: correct history link handling in the library UI#1667
bcullman wants to merge 1 commit intoOctopusDeploy:masterfrom
bcullman:fix-history-link

Conversation

@bcullman
Copy link
Copy Markdown
Contributor

@bcullman bcullman commented Apr 2, 2026

Background

This PR fixes the History link on Library template detail pages.

The current behavior has two problems:

  • the fallback GitHub history link can be generated incorrectly because the filename is extracted using a Windows-only path split
  • when the source path comes from a Linux build agent, that can cause the full absolute /opt/buildagent/.../step-templates/<file>.json path to be embedded into the final URL
  • the History link opens in the current tab, which navigates the user away from the Library page

Results

The History link now preserves the current-master GitHub URL shape under step-templates/<template>.json, uses cross-platform filename extraction, and opens in a new tab.

Before

  • the fallback HistoryUrl depended on file.path.split("\\")
  • when the source path came from a Linux build agent, the generated link could include the full /opt/buildagent/.../step-templates/<file>.json path instead of just <file>.json
  • the History link opened in the current tab

After

  • the fallback HistoryUrl uses path.basename(file.path) for cross-platform filename extraction
  • build-agent absolute paths are reduced to just the template filename before the GitHub URL is built
  • the History link opens in a new tab using target="_blank" and rel="noopener noreferrer"

Pre-requisites

  • Id should be a GUID that is not 00000000-0000-0000-0000-000000000000
    • NOTE If you are modifying an existing step template, please make sure that you do not modify the Id property (updating the Id will break the Library sync functionality in Octopus).
  • Version should be incremented, otherwise the integration with Octopus won't update the step template correctly
  • Parameter names should not start with $
  • Step template parameter names (the ones declared in the JSON, not the script body) should be prefixed with a namespace so that they are less likely to clash with other user-defined variables in Octopus (see this issue). For example, use an abbreviated name of the step template or the category of the step template).
  • LastModifiedBy field must be present, and (optionally) updated with the correct author
  • The best practices documented here have been applied
  • If a new Category has been created:
    • An image with the name {categoryname}.png must be present under the step-templates/logos folder
    • The switch in the humanize function in gulpfile.babel.js must have a case statement corresponding to it

Fixes #1666

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

History link on template detail pages can be incorrect and opens in the same tab

1 participant