diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5330c48c0..a20627137 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -194,7 +194,7 @@ jobs: uses: actions/checkout@v4 with: repository: 'signalapp/Signal-Message-Backup-Tests' - ref: '22d7f507b61691e0a7da1fd4b233f219bdaf2280' + ref: '93a7d29527cb33e6bf23bc56fbf74d62cf682001' path: 'backup-integration-tests' - run: xvfb-run --auto-servernum npm run test-electron diff --git a/protos/Backups.proto b/protos/Backups.proto index 27c958437..8cde79590 100644 --- a/protos/Backups.proto +++ b/protos/Backups.proto @@ -729,8 +729,10 @@ message BodyRange { MONOSPACE = 5; } - optional uint32 start = 1; - optional uint32 length = 2; + // 'start' and 'length' are measured in UTF-16 code units. + // They may refer to offsets in a longText attachment. + uint32 start = 1; + uint32 length = 2; oneof associatedValue { bytes mentionAci = 3; diff --git a/protos/SignalService.proto b/protos/SignalService.proto index 53f487ea4..492df9959 100644 --- a/protos/SignalService.proto +++ b/protos/SignalService.proto @@ -310,9 +310,9 @@ message DataMessage { STRIKETHROUGH = 4; MONOSPACE = 5; } - - optional uint32 start = 1; - optional uint32 length = 2; + + optional uint32 start = 1; // Starting index in UTF-16 code units/raw string representation + optional uint32 length = 2; // Length of range in UTF-16 code units/raw string representation oneof associatedValue { string mentionAci = 3; diff --git a/ts/types/BodyRange.ts b/ts/types/BodyRange.ts index d0298cf09..72396289e 100644 --- a/ts/types/BodyRange.ts +++ b/ts/types/BodyRange.ts @@ -171,11 +171,9 @@ export function filterAndClean( return ranges .map(range => { - const { start, length, ...restOfRange } = range; - if (!isNumber(start)) { - log.warn('filterAndClean: Dropping bodyRange with non-number start'); - return undefined; - } + const { start: startFromRange, length, ...restOfRange } = range; + + const start = startFromRange ?? 0; if (!isNumber(length)) { log.warn('filterAndClean: Dropping bodyRange with non-number length'); return undefined;