Skip to content
Snippets Groups Projects
Unverified Commit dd05c19c authored by Paul Rosenzweig's avatar Paul Rosenzweig Committed by GitHub
Browse files

accept null column in formatUrl (#10314)

parent e7100252
No related merge requests found
......@@ -549,16 +549,10 @@ function isDefaultLinkProtocol(protocol) {
export function formatUrl(
value: Value,
{
jsx,
rich,
view_as = "auto",
link_text,
column: { special_type } = {},
}: FormattingOptions = {},
{ jsx, rich, view_as = "auto", link_text, column }: FormattingOptions = {},
) {
const url = String(value);
const urlSpecialType = isa(special_type, TYPE.URL);
const urlSpecialType = column && isa(column.special_type, TYPE.URL);
const protocol = getUrlProtocol(url);
if (
jsx &&
......
......@@ -265,5 +265,14 @@ describe("formatting", () => {
}),
).toEqual("data:text/plain;charset=utf-8,hello%20world");
});
it("should not crash if column is null", () => {
expect(
formatUrl("foobar", {
jsx: true,
rich: true,
column: null,
}),
).toEqual("foobar");
});
});
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment