Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to prevent updating assets on import #69

Merged

Conversation

daklik
Copy link
Contributor

@daklik daklik commented Jul 12, 2024

Summary

Adds an option to prevent updating attachments if they already exist.

What are the specific steps to test this change?

For example:

  1. Run the website and log in as an admin
  2. Open a piece manager modal and select several pieces
  3. Click the "Archive" button on the top left of the manager and confirm that it should proceed
  4. Check that all pieces have been archived properly

What kind of change does this PR introduce?

(Check at least one)

  • Bug fix
  • New feature
  • Refactor
  • Documentation
  • Build-related changes
  • Other

Make sure the PR fulfills these requirements:

  • It includes a) the existing issue ID being resolved, b) a convincing reason for adding this feature, or c) a clear description of the bug it resolves
  • The changelog is updated
  • Related documentation has been updated
  • Related tests have been updated

If adding a new feature without an already open issue, it's best to open a feature request issue first and wait for approval before working on it.

Other information:


### Adds

* Adds a `preventUpdateAssets` to the module that will not try to update already existing assets on import.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right to want this to change, because it is doing a great deal of extra work, but the actual fix is different... attachments are immutable, except for crops, docIds and archivedDocIds. Therefore the file itself should never need to be re-uploaded, although some crops present in the imported database might need to be inserted, which I don't see happening in the existing code.

So I will discuss with the team, I think this would make more sense as a warranty issue in gitlab.

My fault perhaps for making attachments do so much complicated bookkeeping to avoid copies, but copies are very expensive when multiplied across all modes and locales.

Copy link
Member

@boutell boutell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving this in its current form as an important workaround for a special case that has since been explained to me: because of the limitation currently in place that the entire upload must fit in a single POST request, their team is using smaller images as placeholders during imports, but they cannot afford to have these replacing existing images they already swapped out for full size.

We have an internal ticket on our roadmap to work around the POST limit in the future.

@BoDonkey BoDonkey merged commit 2b3e151 into apostrophecms:main Jul 12, 2024
0 of 9 checks passed
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.

3 participants