-
Notifications
You must be signed in to change notification settings - Fork 677
DYN-6409: Disable PM requests with no-network mode #16191
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
Changes from 8 commits
2dabdd1
11953c9
4f32e6a
292930c
f458121
1793679
0c71b76
cd5d310
be498b8
e971915
f0ce1e3
cbb6ec5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -49,18 +49,24 @@ public string BaseUrl | |||||||||||||
| get { return this.client.BaseUrl; } | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| internal readonly bool NoNetworkMode; | ||||||||||||||
|
|
||||||||||||||
| #endregion | ||||||||||||||
|
|
||||||||||||||
| internal PackageManagerClient(IGregClient client, IPackageUploadBuilder builder, string packageUploadDirectory) | ||||||||||||||
| internal PackageManagerClient(IGregClient client, IPackageUploadBuilder builder, string packageUploadDirectory, | ||||||||||||||
| bool noNetworkMode = false) | ||||||||||||||
| { | ||||||||||||||
| this.packageUploadDirectory = packageUploadDirectory; | ||||||||||||||
| this.uploadBuilder = builder; | ||||||||||||||
| this.client = client; | ||||||||||||||
| this.packageMaintainers = new Dictionary<string, bool>(); | ||||||||||||||
| this.NoNetworkMode = noNetworkMode; | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| internal bool Upvote(string packageId) | ||||||||||||||
| { | ||||||||||||||
| if (NoNetworkMode) return false; | ||||||||||||||
|
|
||||||||||||||
| return FailFunc.TryExecute(() => | ||||||||||||||
| { | ||||||||||||||
| var pkgResponse = this.client.ExecuteAndDeserialize(new Upvote(packageId)); | ||||||||||||||
|
|
@@ -70,6 +76,8 @@ internal bool Upvote(string packageId) | |||||||||||||
|
|
||||||||||||||
| internal List<string> UserVotes() | ||||||||||||||
| { | ||||||||||||||
| if (NoNetworkMode) return null; | ||||||||||||||
|
||||||||||||||
| if (NoNetworkMode) return null; | |
| if (NoNetworkMode) return new List<string>(); |
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?
Copilot
AI
May 22, 2025
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.
[nitpick] This method throws an exception on offline mode, but other methods return null or defaults. Consider unifying the error-handling strategy across package manager methods.
| if (NoNetworkMode) throw new Exception(DynamoPackages.Properties.Resources.DownloadPackageDisabled); | |
| if (NoNetworkMode) | |
| { | |
| pathToPackage = null; | |
| return PackageManagerResult.Failed(DynamoPackages.Properties.Resources.DownloadPackageDisabled); | |
| } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.