Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
granuleInCmr.RelatedUrls.forEach((relatedUrl) => {
// only check URL types for downloading granule files and related data (such as documents)
if (cmrGetDataTypes.includes(relatedUrl.Type)
|| cmrRelatedDataTypes.includes(relatedUrl.Type)) {
const urlFileName = relatedUrl.URL.split('/').pop();
// filename in both cumulus and CMR
if (granuleFiles[urlFileName] && bucketsConfig.key(granuleFiles[urlFileName].bucket)) {
// not all files should be in CMR
const accessUrl = constructOnlineAccessUrl({
file: granuleFiles[urlFileName],
distEndpoint: process.env.DISTRIBUTION_ENDPOINT,
buckets: bucketsConfig
});
if (accessUrl && relatedUrl.URL === accessUrl.URL) {
okCount += 1;
} else if (cmrGetDataTypes.includes(relatedUrl.Type)) {
// ignore any URL which is not for getting data
// some files should not be in CMR such as private files
onlyInCmr.push({
URL: relatedUrl.URL,
Type: relatedUrl.Type,
GranuleUR: granuleInCmr.GranuleUR
});
}