Skip to content

Commit

Permalink
fix: check urls are string before trimming
Browse files Browse the repository at this point in the history
  • Loading branch information
rarkins committed May 5, 2021
1 parent 2fd85a0 commit 31ba0a5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/datasource/metadata.ts
Expand Up @@ -4,6 +4,7 @@ import { DateTime } from 'luxon';
import * as hostRules from '../util/host-rules';
import { validateUrl } from '../util/url';
import type { ReleaseResult } from './types';
import is from '@sindresorhus/is';

// Use this object to define changelog URLs for packages
// Only necessary when the changelog data cannot be found in the package's source repository
Expand Down Expand Up @@ -231,7 +232,7 @@ export function addMetaData(
// Clean up any empty urls
const urls = ['homepage', 'sourceUrl', 'changelogUrl', 'dependencyUrl'];
for (const url of urls) {
if (validateUrl(dep[url]?.trim())) {
if (is.string(dep[url]) && validateUrl(dep[url].trim())) {
dep[url] = dep[url].trim();
} else {
delete dep[url];
Expand Down

0 comments on commit 31ba0a5

Please sign in to comment.