-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Fix retrieving dynamic parameters from provider even if globbed path returns no results #15525
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was very wonder to read comments in the method above.
Is the method used for both FromSession and ToSession?
If so I wonder again because obviously the method is only for FromSession scenario.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is independent from
ToSession
andFromSession
, it applies to all dynamic parametersThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I say that original design was broken - it makes no sense to check the path existence if it is on remote.
Next question is does it make sense to check the existence for local path? If it even makes sense this is the wrong place for it - all we need is the providerInstance as you said.
Do we really need globbing? I suggest to make minor breaking change and use GetUnresolvedProviderPathFromPSPath() or GetProviderPath().
Then if providerInstance is null then pathNotFoundOnClient is always true and we always effectively fall back to FileSystemProvider:
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what the original design intent was, but the path(s) after globbing are passed down to the provider for dynamic parameters (so null is now possible where it wasn't before, but it's an assert so could have happened in retail builds anyways), so presumably a provider could use that information and we should probably not make that breaking change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This just makes me think that it's much more useful to pass the original path than after globbing, otherwise in CopyItemDynamicParameters there's no way to know that globbing was used. I believe it is more right design and the breaking change is under bracket 3 (unlikely breaking change).
Although if you find it totally unacceptable, it's worth cleaning up the code anyway, like in my sample.
providerPath argument is never null in CopyItemDynamicParameters().
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not
providerPath
, but justpath
. I think if provider authors would find value in the original search path, we would have heard about it. I don't think it's worth making this change.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand. The method starts with:
I guess nobody uses this :-) I mainly think that the binder is already too slow and we could make it faster.
Moreover, we have already made a breaking change by passing a non-existent file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that this is code seems wrong and that parameter binding is not the right place to do path validation. My guess is this code was here when copy-item was local only, and then adjusted when copy-item was extended to support remote copy.
I feel it is worth considering a breaking change to re-review this and possibly fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to take a small change now to improve the user experience (they would get an error from the provider instead of the parameter binder not helping them understand why it didn't work) and defer any potential breaking change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is reasonable. Can you create an issue to track it?