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

DYN-8100: Handle opening file paths that include archived locations #15851

Merged
merged 11 commits into from
Mar 4, 2025

Conversation

LongNguyenP
Copy link
Contributor

@LongNguyenP LongNguyenP commented Feb 24, 2025

Purpose

The PR handles opening file paths that include archived locations.
In Windows, it is possible to explore a zip archive without extracting it, the PR addresses those cases where the file path includes a zipped(archived) location for example: C:\Program Files\Archive.zip\Graph.dyn in this case an error message will be displayed.

Screenshot 2025-03-03 at 3 58 24 PM

Declarations

Check these if you believe they are true

  • The codebase is in a better state after this PR
  • Is documented according to the standards
  • The level of testing this PR includes is appropriate
  • User facing strings, if any, are extracted into *.resx files
  • All tests pass using the self-service CI.
  • Snapshot of UI changes, if any.
  • Changes to the API follow Semantic Versioning and are documented in the API Changes document.
  • This PR modifies some build requirements and the readme is updated
  • This PR contains no files larger than 50 MB

Release Notes

Handle opening invalid file paths such as archives, and show an error message

Reviewers

@DynamoDS/dynamo

@github-actions github-actions bot changed the title First commit, not yet working DYN-8100: First commit, not yet working Feb 24, 2025
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

See the ticket for this pull request: https://jira.autodesk.com/browse/DYN-8100

var jsonDynFile = ResourceUtilities.LoadContentFromResources(GuidesManager.OnboardingGuideWorkspaceEmbeededResource, Assembly.GetExecutingAssembly(), false, false);
OpenFromJson(new Tuple<string, bool>(jsonDynFile, true));
}

private bool CanOpen(object parameters)
{
var filePath = parameters as string;

if (filePath.Contains(".zip\\") || filePath.Contains(".ZIP\\"))
Copy link
Contributor

Choose a reason for hiding this comment

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

@LongNguyenP I think we need something more concrete as in Windows a directory can also be named with .zip in its name like, ABCD.zip. And in that case this check will cause problems. May be incrementally check if each part of the path is a directory except the last one?

Copy link
Contributor Author

@LongNguyenP LongNguyenP Feb 27, 2025

Choose a reason for hiding this comment

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

@zeuso
Yes I thought of that scenario, that was why the comparision pattern is ".zip\\" rather than just ".zip" . I think this is likely sufficient (without incremental checking each part of the path).

Copy link
Member

Choose a reason for hiding this comment

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

what about 7zip archives? (.7z)

@LongNguyenP LongNguyenP changed the title DYN-8100: First commit, not yet working DYN-8100: Openning a zipped dyn file. Feb 27, 2025
Copy link
Contributor

@RobertGlobant20 RobertGlobant20 left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -922,8 +922,8 @@ internal void CrashGracefully(Exception ex, bool fatal = false)
{
exceptionAssembly = ex.InnerException?.TargetSite?.Module?.Assembly;
}

Copy link
Contributor

Choose a reason for hiding this comment

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

do you know why there are too many empty space changes?
Seems like there are too much changes but most of them are due to the space space removal.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, i noticed those, no idea why they got added, but seems to be correct though, so I did not remove.

Copy link
Contributor

Choose a reason for hiding this comment

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

In my experience if your editor isn't set to strip trailing spaces these creep in without anyone being the wiser. Might make sense to align on whether we make this setting? On Vera we had a linter which would fail on trailing space. That's going a bit far I think, but it did ensure this sort of thing was kept clean.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you share the link to that linter? Was that at a PR check level?

Copy link
Contributor

Choose a reason for hiding this comment

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

Well, the one I refer to was on TypeScript (tslint). But it looks like this could be accomplished with git hooks: https://stackoverflow.com/questions/591923/make-git-automatically-remove-trailing-white-space-before-committing.

Copy link
Contributor

@avidit avidit Mar 5, 2025

Choose a reason for hiding this comment

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

@zeusongit zeusongit changed the title DYN-8100: Openning a zipped dyn file. DYN-8100: Handle opening file paths that include archived locations Mar 4, 2025
@@ -94,7 +94,7 @@ public DialogResult ShowDialog()

IShellItem dialogResult;
_dialog.GetResult(out dialogResult);
dialogResult.GetDisplayName(SIGDN.SIGDN_FILESYSPATH, out _fileName);
dialogResult.GetDisplayName(SIGDN.SIGDN_DESKTOPABSOLUTEEDITING, out _fileName);
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this because the SIGDN_FILESYSPATH is not shown for some cases?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, in cases where zip file was part of the path, it threw an error.

@zeusongit zeusongit merged commit 10b6647 into master Mar 4, 2025
22 of 23 checks passed
@zeusongit zeusongit deleted the DYN-8100 branch March 4, 2025 17:29
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.

7 participants