fix default region reversion
authorJoey Hess <joeyh@joeyh.name>
Wed, 13 Aug 2025 18:19:36 +0000 (14:19 -0400)
committerJoey Hess <joeyh@joeyh.name>
Wed, 13 Aug 2025 18:19:36 +0000 (14:19 -0400)
Commit 215640096f6a3469c119d50373f3035cf19fe130 caused the default
region for S3 to change to us-east-2. This was due to regionInfo having
an undocumented property that the first item in the list is for the
default region.

Avoid relying on regionInfo for defaultRegion.

Sponsored-by: Dartmouth College's DANDI project
Remote/Helper/AWS.hs

index 2c9d535a85b58fc4fade17e63e684b3e7e0513ce..e03f1b4591a4f63ac4d2eb690f2b5ea1f46e0b9b 100644 (file)
@@ -1,6 +1,6 @@
 {- Amazon Web Services common infrastructure.
  -
- - Copyright 2011-2014 Joey Hess <id@joeyh.name>
+ - Copyright 2011-2025 Joey Hess <id@joeyh.name>
  -
  - Licensed under the GNU AGPL version 3 or higher.
  -}
@@ -40,7 +40,8 @@ regionMap :: Service -> M.Map Text Region
 regionMap = M.fromList . regionInfo
 
 defaultRegion :: Service -> Region
-defaultRegion = snd . fromMaybe (error "internal") . headMaybe . regionInfo
+defaultRegion S3 = "US"
+defaultRegion Glacier = "us-east-1"
 
 data ServiceRegion = BothRegion Region | S3Region Region | GlacierRegion Region