From abf2574312ca16eec6407a95833622cb235606c4 Mon Sep 17 00:00:00 2001 From: David Walsh Date: Tue, 27 Feb 2018 11:46:41 -0600 Subject: [PATCH] Highlight original source for sources tree (#5511) --- src/components/PrimaryPanes/SourcesTree.js | 3 ++- src/utils/source.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/PrimaryPanes/SourcesTree.js b/src/components/PrimaryPanes/SourcesTree.js index 4adbb66535..0993be8b9b 100644 --- a/src/components/PrimaryPanes/SourcesTree.js +++ b/src/components/PrimaryPanes/SourcesTree.js @@ -42,6 +42,7 @@ import { getExtension } from "../../utils/sources-tree"; +import { getRawSourceURL } from "../../utils/source"; import { copyToTheClipboard } from "../../utils/clipboard"; import { features } from "../../utils/prefs"; @@ -132,7 +133,7 @@ class SourcesTree extends Component { nextProps.selectedSource != selectedSource ) { const highlightItems = getDirectories( - nextProps.selectedSource.get("url"), + getRawSourceURL(nextProps.selectedSource.get("url")), sourceTree ); diff --git a/src/utils/source.js b/src/utils/source.js index 644d1a3a35..4cf0f98601 100644 --- a/src/utils/source.js +++ b/src/utils/source.js @@ -115,7 +115,7 @@ export function getPrettySourceURL(url: ?string): string { * @static */ export function getRawSourceURL(url: string): string { - return url.replace(/:formatted$/, ""); + return url ? url.replace(/:formatted$/, "") : url; } function resolveFileURL(