Skip to content

Commit

Permalink
win: unify setting default reg values, fix errors $380
Browse files Browse the repository at this point in the history
Start by changing compiler so having whitespace between `with`
statements do not result in arbitrary revert code.

- Fix incorrect revert codes (adding value instead of deleting) for:
  - `HKLM\SOFTWARE\Policies\Microsoft\Windows\CloudContent!DisableSoftLanding`
  - `HKLM\Software\Policies\Microsoft\Windows\CloudContent!DisableWindowsConsumerFeatures`
  - `HKCU\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager!SubscribedContent-338393Enabled`
  - `HKCU\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager!SubscribedContent-353694Enabled`
  - `HKCU\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager!SubscribedContent-353696Enabled`
  • Loading branch information
undergroundwires committed Jul 9, 2024
1 parent 0239b52 commit 4553642
Show file tree
Hide file tree
Showing 3 changed files with 181 additions and 86 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
export function isTruthy(value: string | undefined | null): value is string {
if (value === undefined) {
return true;
}
if (value === null) {
return true;
}
if (value.length === 0) {
return true;
}
if (value.trim().length === 0) {
return true;
}
return false;
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { FunctionParameterCollection } from '@/application/Parser/Executable/Scr
import { ExpressionPosition } from '../Expression/ExpressionPosition';
import { ExpressionRegexBuilder } from '../Parser/Regex/ExpressionRegexBuilder';
import { createPositionFromRegexFullMatch } from '../Expression/ExpressionPositionFactory';
import { isTruthy } from './IsFalsy';
import type { IExpression } from '../Expression/IExpression';

export class WithParser implements IExpressionParser {
Expand Down Expand Up @@ -99,7 +100,7 @@ class WithStatementBuilder {
const argumentValue = context.args.hasArgument(this.parameterName)
? context.args.getArgument(this.parameterName).argumentValue
: undefined;
if (!argumentValue) {
if (!isTruthy(argumentValue)) {
return '';
}
const substitutedScope = this.substituteContextVariables(scope, (pipeline) => {
Expand Down
Loading

0 comments on commit 4553642

Please sign in to comment.