diff --git a/app/client/models/gristUrlState.ts b/app/client/models/gristUrlState.ts index 1d9fa247..4c5c3b15 100644 --- a/app/client/models/gristUrlState.ts +++ b/app/client/models/gristUrlState.ts @@ -224,7 +224,7 @@ export class UrlStateImpl { /** * Given value like `foo bar baz`, constructs URL by checking if `baz` is a valid URL and, - * if not, prepending `http://`. + * if not, prepending `https://`. */ export function constructUrl(value: CellValue): string { if (typeof value !== 'string') { @@ -235,8 +235,8 @@ export function constructUrl(value: CellValue): string { // Try to construct a valid URL return (new URL(url)).toString(); } catch (e) { - // Not a valid URL, so try to prefix it with http - return 'http://' + url; + // Not a valid URL, so try to prefix it with https + return 'https://' + url; } } diff --git a/app/client/ui/MarkdownCellRenderer.ts b/app/client/ui/MarkdownCellRenderer.ts index 036572ff..4151a65b 100644 --- a/app/client/ui/MarkdownCellRenderer.ts +++ b/app/client/ui/MarkdownCellRenderer.ts @@ -1,10 +1,11 @@ +import {constructUrl} from 'app/client/models/gristUrlState'; import {gristIconLink} from 'app/client/ui2018/links'; import escape from 'lodash/escape'; import {marked} from 'marked'; export const renderer = new marked.Renderer(); -renderer.link = ({href, text}) => gristIconLink(href, text).outerHTML; +renderer.link = ({href, text}) => gristIconLink(constructUrl(href), text).outerHTML; // Disable Markdown features that we aren't ready to support yet. renderer.hr = ({raw}) => raw;