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

Support bitbucket permalinks #66

Merged
merged 4 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "weaudit",
"displayName": "weAudit",
"description": "Bookmark findings and quickly navigate to areas of interest in the codebase",
"version": "1.2.2",
"version": "1.2.3",
"publisher": "trailofbits",
"author": "Trail of Bits",
"categories": [],
Expand Down
15 changes: 13 additions & 2 deletions src/codeMarker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1047,6 +1047,9 @@ class WARoot {
this.clientRemote = clientRemote;
this.gitRemote = auditRemote;
this.gitSha = gitSha;

// persist the data
this.updateSavedData(this.username);
}
}

Expand Down Expand Up @@ -2504,8 +2507,16 @@ export class CodeMarker implements vscode.TreeDataProvider<TreeEntry> {
return;
}

const issueLocation = `#L${location.startLine + 1}-L${location.endLine + 1}`;
const permalink = gitRemote + "/blob/" + sha + "/" + location.path + issueLocation;
const remoteHost = URL.parse(gitRemote)?.hostname;
let permalink;
if (remoteHost === "bitbucket.org") {
const issueLocation = `#lines-${location.startLine + 1}:${location.endLine + 1}`;
permalink = gitRemote + "/src/" + sha + "/" + location.path + issueLocation;
} else {
const issueLocation = `#L${location.startLine + 1}-L${location.endLine + 1}`;
permalink = gitRemote + "/blob/" + sha + "/" + location.path + issueLocation;
}

return { remote: gitRemote, permalink };
}

Expand Down
Loading