Project

General

Profile

Actions

Defect #42545

closed

Commit message in issue history might be rendered in incorrect context

Added by Felix Schäfer 11 days ago. Updated about 13 hours ago.

Status:
Closed
Priority:
Normal
Category:
Text formatting
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

The commit messages of changesets associated with an issues are always rendered in the context of that issue in the issue's history view. This might not be the correct context if cross-project relations between issues and changesets are allowed and the changeset comes from a repository associated to another project.

For example if a commit message references a wiki page, the rendered wiki page link in the issue history will reference the wiki page of the issue's project instead of the wiki page of the repository's project.


Files

42545-20250408114000.patch (2.11 KB) 42545-20250408114000.patch Felix Schäfer, 2025-04-08 11:42
Actions #1

Updated by Felix Schäfer 11 days ago

The issue is because the textilizable method will use @project as the context if available. In the case of format_changeset_comments this might not always be the correct project context. Forcing the project to be the changeset's project solves this issue.

The attached patch solves the issue and adds a test. In the test the issue's project does not have the wiki module enabled and the issue history will not replace [[wiki]] with a link to a wiki page but will render the string [[wiki]] as is. With the fix this link is rendered correctly and links to the repository's project wiki page. Please note that the textilizable method checks the current user's permissions before rendering links, the change should not introduce security concerns.

Actions #2

Updated by Go MAEDA 8 days ago

  • Tracker changed from Patch to Defect
  • Category changed from UI to Text formatting
  • Status changed from New to Confirmed
  • Target version set to 5.1.8

Setting the target version to 5.1.8.

Actions #3

Updated by Marius BĂLTEANU about 14 hours ago

  • Status changed from Confirmed to Resolved
  • Assignee set to Marius BĂLTEANU
  • Resolution set to Fixed

Committed the patch and also a fix to some failing tests caused by the extra revision added to the database. I've changed the assertion from test_search_all_projects because "Feature request #2" is not anymore included in the results of page 1. I chose another issue from the same project.

Actions #4

Updated by Marius BĂLTEANU about 13 hours ago

  • Status changed from Resolved to Closed

All tests pass now, I've merged the revisions to the stable branches.

Actions

Also available in: Atom PDF