瀏覽代碼

Fixes #1202 - fixes unneeded url encoding

main
Eric Amodio 4 年之前
父節點
當前提交
545dc4aac1
共有 2 個文件被更改,包括 28 次插入20 次删除
  1. +6
    -0
      CHANGELOG.md
  2. +22
    -20
      src/git/remotes/provider.ts

+ 6
- 0
CHANGELOG.md 查看文件

@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased]
### Fixed
- Fixes [#1202](https://github.com/eamodio/vscode-gitlens/issues/1202) - "Copy Remote File Url" url-encodes the URL
## [11.0.6] - 2020-11.28
### Changed

+ 22
- 20
src/git/remotes/provider.ts 查看文件

@ -152,32 +152,34 @@ export abstract class RemoteProvider {
url(resource: RemoteResource): string | undefined {
switch (resource.type) {
case RemoteResourceType.Branch:
return this.getUrlForBranch(encodeURIComponent(resource.branch));
return encodeURI(this.getUrlForBranch(resource.branch));
case RemoteResourceType.Branches:
return this.getUrlForBranches();
return encodeURI(this.getUrlForBranches());
case RemoteResourceType.Commit:
return this.getUrlForCommit(encodeURIComponent(resource.sha));
case RemoteResourceType.Comparison:
return this.getUrlForComparison?.(
encodeURIComponent(resource.ref1),
encodeURIComponent(resource.ref2),
resource.notation ?? '...',
);
return encodeURI(this.getUrlForCommit(resource.sha));
case RemoteResourceType.Comparison: {
const url = this.getUrlForComparison?.(resource.ref1, resource.ref2, resource.notation ?? '...');
return url != null ? encodeURI(url) : undefined;
}
case RemoteResourceType.File:
return this.getUrlForFile(
encodeURIComponent(resource.fileName),
resource.branch != null ? encodeURIComponent(resource.branch) : undefined,
undefined,
resource.range,
return encodeURI(
this.getUrlForFile(
resource.fileName,
resource.branch != null ? resource.branch : undefined,
undefined,
resource.range,
),
);
case RemoteResourceType.Repo:
return this.getUrlForRepository();
return encodeURI(this.getUrlForRepository());
case RemoteResourceType.Revision:
return this.getUrlForFile(
encodeURIComponent(resource.fileName),
resource.branch != null ? encodeURIComponent(resource.branch) : undefined,
resource.sha != null ? encodeURIComponent(resource.sha) : undefined,
resource.range,
return encodeURI(
this.getUrlForFile(
resource.fileName,
resource.branch != null ? resource.branch : undefined,
resource.sha != null ? resource.sha : undefined,
resource.range,
),
);
default:
return undefined;

Loading…
取消
儲存