Skip to content

Commit b442494

Browse files
committed
Fixes #2037 saving autolinks w/ bogus cache props
1 parent 10bb136 commit b442494

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).
66

7+
## [Unreleased]
8+
9+
## Fixed
10+
11+
- Fixes [#2037](https://github.com/gitkraken/vscode-gitlens/issues/2037) - Autolinks can end up getting saved with invalid (cached) properties
12+
713
## [12.1.0] - 2022-06-14
814

915
## Added
@@ -4213,6 +4219,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
42134219

42144220
- Initial release but still heavily a work in progress.
42154221

4222+
[unreleased]: https://github.com/gitkraken/vscode-gitlens/compare/v12.1.0...HEAD
42164223
[12.1.0]: https://github.com/gitkraken/vscode-gitlens/compare/v12.0.7...gitkraken:v12.1.0
42174224
[12.0.6]: https://github.com/gitkraken/vscode-gitlens/compare/v12.0.6...gitkraken:v12.0.7
42184225
[12.0.6]: https://github.com/gitkraken/vscode-gitlens/compare/v12.0.5...gitkraken:v12.0.6

src/annotations/autolinks.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ export class Autolinks implements Disposable {
6161

6262
private onConfigurationChanged(e?: ConfigurationChangeEvent) {
6363
if (configuration.changed(e, 'autolinks')) {
64-
this._references = this.container.config.autolinks ?? [];
64+
const autolinks = configuration.get('autolinks');
65+
// Since VS Code's configuration objects are live we need to copy them to avoid writing back to the configuration
66+
this._references = autolinks != null ? autolinks.map(a => ({ ...a })) : [];
6567
}
6668
}
6769

@@ -199,6 +201,7 @@ export class Autolinks implements Disposable {
199201
issuesOrPullRequests?: Map<string, IssueOrPullRequest | PromiseCancelledError | undefined>,
200202
): ref is CacheableAutolinkReference | DynamicAutolinkReference {
201203
if (isDynamic(ref)) return true;
204+
if (!ref.prefix || !ref.url) return false;
202205

203206
try {
204207
if (ref.messageMarkdownRegex == null) {

0 commit comments

Comments
 (0)