Skip to content

Harden attachment download and repeater handling in pull sync#56

Open
manuel-be-one wants to merge 1 commit into
Bynder:mainfrom
manuel-be-one:fix/sync-pull-attachment-and-repeater-handling
Open

Harden attachment download and repeater handling in pull sync#56
manuel-be-one wants to merge 1 commit into
Bynder:mainfrom
manuel-be-one:fix/sync-pull-attachment-and-repeater-handling

Conversation

@manuel-be-one
Copy link
Copy Markdown

Summary

This PR makes the pull sync more resilient when handling repeaters and downloaded media attachments.

What changed

  • Skip empty repeater subfield keys when preparing repeater data.
  • Guard against missing sub_fields before iterating.
  • Reuse an existing attachment only when its file still exists on disk.
  • Delete stale attachments before re-downloading the file.
  • Write the downloaded response body to disk correctly.
  • Avoid appending a duplicate extension when the filename already has one.

Why

The pull sync could fail or create inconsistent media entries when the remote asset was missing locally, when attachment metadata was stale, or when the downloaded filename already had an extension.

Testing

  • Verified repeater handling with and without subfields.
  • Verified attachment reuse when the file exists.
  • Verified fallback download when the existing attachment file is missing.
  • Verified filenames with an existing extension are not duplicated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant