Skip to content

Commit a8c3bd7

Browse files
authored
s3: note object names should NOT depend on bucket or server (#1826)
Ref getodk/central#1862
1 parent a2cb32c commit a8c3bd7

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

lib/external/s3.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,20 @@ const init = (config) => {
116116

117117
const objectNameFor = ({ id, sha }) => {
118118
// Include blob ID in object name to allow easy correlation with postgres data.
119+
//
119120
// Include blob SHA sum to prevent name collision in case multiple odk-central-
120121
// backend instances point to the same bucket. There are a few scenarios where
121122
// this could happen, e.g.
122123
//
123124
// * instance reset after testing/training
124125
// * staging & prod instances pointed to the same bucket
125126
// * temporary loss of access to postgres data on upgrade error
127+
//
128+
// To allow restoring from backups, do NOT include:
129+
//
130+
// * S3 server URL
131+
// * bucket name
132+
126133
if (typeof id !== 'number') throw new Error('Invalid id: ' + id);
127134
if (!sha) throw new Error('Missing sha sum for blob: ' + id);
128135
return `${objectPrefix??''}blob-${id}-${sha}`;

0 commit comments

Comments
 (0)