Skip to content

Commit 77230e8

Browse files
committed
Fixed failing test
1 parent 8b14dd3 commit 77230e8

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/core/Util.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,12 +239,20 @@ export const validateAndSanitizeConfig = (config) => {
239239
}
240240

241241
export const getRegionEndpoint = (region, service = 'contentManagement') => {
242+
// Validate input
243+
if (!region || typeof region !== 'string') {
244+
throw new Error(`Invalid region '${region}' provided. Allowed regions are: ${regionHostMap.regions.map(r => r.id).join(', ')}`)
245+
}
246+
247+
// Case-sensitive matching: only match exact case
242248
const regionData = regionHostMap.regions.find(r =>
243249
r.id === region ||
244250
r.alias.some(alias => alias === region)
245251
)
252+
246253
if (!regionData) {
247254
throw new Error(`Invalid region '${region}' provided. Allowed regions are: ${regionHostMap.regions.map(r => r.id).join(', ')}`)
248255
}
256+
249257
return regionData.endpoints[service]?.replace(/^https?:\/\//, '')
250258
}

0 commit comments

Comments
 (0)