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

[SYNPY-1557] Sync a Linked Folder Bug #1157

Merged
merged 8 commits into from
Jan 30, 2025
Merged

Conversation

BWMac
Copy link
Contributor

@BWMac BWMac commented Jan 30, 2025

Description

A user recently reported unexpected behavior when using the following command:

synapse get -r --followLink --downloadLocation my_folder syn123

The folder being recursively downloaded (synced) contained a link to another Synapse folder, and an error was being thrown:

FileNotFoundError: [Errno 2] No such file or directory: 'my_folder/my_linked_subfolder/SYNAPSE_METADATA_MANIFEST.tsv'

In short, the Synapse client was unable to properly mirror the folder structure with a linked folder in it. We would expect that linked folder to be created as a subfolder containing the files that it does on Synapse.

In order to enable this behavior, I first wrote an integration test to check that the client was giving the desired behavior in this situation with the expectation that the test would throw the same error until a fix was implemented. Then, I dug into the code and discovered that in _follow_link, we were previously not tracking the target name for the linked entity, which was causing a locally created folder mirroring the linked Synapse folder not to be created by the child task, resulting in the error. After adding that tracking (passing the name on to _create_task_for_child) within _follow_link, the test passed and I was able to successfully sync the folder from the original user report.

Previous behavior for syncing "normal" child folders and files was not adversely effected by the change. I tested this manually on my own test project, on the location reported by the user, and through ensuring that the existing integration tests still pass.

@BWMac BWMac marked this pull request as ready for review January 30, 2025 15:06
@BWMac BWMac requested a review from a team as a code owner January 30, 2025 15:06
Copy link
Contributor

@BryanFauble BryanFauble left a comment

Choose a reason for hiding this comment

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

Thanks for the patch!

Copy link
Member

@thomasyu888 thomasyu888 left a comment

Choose a reason for hiding this comment

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

🔥 Great find.

@BWMac BWMac merged commit 65422cf into develop Jan 30, 2025
19 of 25 checks passed
@BWMac BWMac deleted the synpy-1557-sync-linked-folder-bug branch January 30, 2025 17:09
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