Change parameter type + extract local variable
This commit is contained in:
@@ -98,7 +98,7 @@ export function isStringLoc(loc: UrlValue): loc is string {
|
|||||||
export function tryGetRemoteLocation(
|
export function tryGetRemoteLocation(
|
||||||
loc: UrlValue | undefined,
|
loc: UrlValue | undefined,
|
||||||
fileLinkPrefix: string,
|
fileLinkPrefix: string,
|
||||||
sourceLocationPrefix: string,
|
sourceLocationPrefix: string | undefined,
|
||||||
): string | undefined {
|
): string | undefined {
|
||||||
const resolvableLocation = tryGetResolvableLocation(loc);
|
const resolvableLocation = tryGetResolvableLocation(loc);
|
||||||
if (!resolvableLocation) {
|
if (!resolvableLocation) {
|
||||||
|
|||||||
@@ -48,10 +48,11 @@ const Cell = ({
|
|||||||
return <span>{convertNonPrintableChars(value.toString())}</span>;
|
return <span>{convertNonPrintableChars(value.toString())}</span>;
|
||||||
case 'object': {
|
case 'object': {
|
||||||
const url = tryGetRemoteLocation(value.url, fileLinkPrefix, sourceLocationPrefix);
|
const url = tryGetRemoteLocation(value.url, fileLinkPrefix, sourceLocationPrefix);
|
||||||
|
const safeLabel = convertNonPrintableChars(value.label);
|
||||||
if (url) {
|
if (url) {
|
||||||
return <Link href={url}>{convertNonPrintableChars(value.label)}</Link>;
|
return <Link href={url}>{safeLabel}</Link>;
|
||||||
} else {
|
} else {
|
||||||
return <span>{convertNonPrintableChars(value.label)}</span>;
|
return <span>{safeLabel}</span>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user