Skip to content

Commit

Permalink
[preview] Fixes broken image preview after URI change.
Browse files Browse the repository at this point in the history
Signed-off-by: Sven Efftinge <sven.efftinge@typefox.io>
  • Loading branch information
svenefftinge committed Jun 20, 2019
1 parent 711e3ce commit 910bf41
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/preview/src/browser/preview-link-normalizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ import { MiniBrowserEndpoint } from '@theia/mini-browser/lib/browser/location-ma
@injectable()
export class PreviewLinkNormalizer {

protected urlScheme = new RegExp('^[a-z][a-z|0-9|\+|\-|\.]*:', 'i');

normalizeLink(documentUri: URI, link: string): string {
try {
const uri = new URI(link);
if (!uri.scheme) {
if (!this.urlScheme.test(link)) {
const location = documentUri.parent.resolve(link).path.toString();
return new MiniBrowserEndpoint().getRestUrl().resolve(location).toString();
}
Expand Down

0 comments on commit 910bf41

Please sign in to comment.