Переглянути джерело

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;

Завантаження…
Відмінити
Зберегти