Skip to content

SAK-51363 Forums deleting a topic that was duplicated would remove attachment used by other topics #13638

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ottenhoff
Copy link
Contributor

When duplicating a topic with attachments, the original implementation reused the same attachment ID, creating a shared reference to the same underlying file.

This caused problems when a duplicated topic was deleted, as it would try to access attachments that no longer existed.

The fix:

  1. Added a new createDuplicateDFAttachment method to properly copy attachment files
  2. Modified duplicateTopic to use the new method, ensuring each attachment gets a true copy
  3. Uses ContentHostingService.copyAttachment to create actual copies of files

ottenhoff and others added 2 commits April 22, 2025 10:55
When duplicating a topic with attachments, the original implementation reused the same attachment ID, creating a shared reference to the same underlying file.
This caused problems when a duplicated topic was deleted, as it would try to access attachments that no longer existed.

The fix:
1. Added a new createDuplicateDFAttachment method to properly copy attachment files
2. Modified duplicateTopic to use the new method, ensuring each attachment gets a true copy
3. Uses ContentHostingService.copyAttachment to create actual copies of files

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@jesusmmp
Copy link
Contributor

I think this patch is not working fine... also this solution is only to topics. What about forums?

@ottenhoff
Copy link
Contributor Author

idk about forums. it wasn't part of the JIRA. happy to deal with it later. what is not working fine? i tested locally and it fixed the test case.

@ern ern changed the title SAK-51363 Forums Fix topic duplication bug when topics have attachments SAK-51363 Forums deleting a topic that was duplicated would remove attachment used by other topics Apr 25, 2025
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