Skip to content

Filter interaction with '+' in string literals #3522

@zwittgens

Description

@zwittgens

Describe the bug

Issue

Passing filters to (at the very least, haven't tested others) Get-MgBetaDeviceAppManagementMobileApp which contain a term filtering on a string containing a '+' followed by a term wrapped in parentheses results in incorrect return results.
Version: 2.35.1

Examples

I have two win32 apps called "PMPC - Notepad++" and "PMPC - Test"

Notepad++
Get-MgBetaDeviceAppManagementMobileApp -Filter "(DisplayName eq 'PMPC - Notepad++') and (isof('microsoft.graph.win32LobApp))
Returns no matching apps

Get-MgBetaDeviceAppManagementMobileApp -Filter "(DisplayName eq 'PMPC - Notepad++') and isof('microsoft.graph.win32LobApp)
Returns the proper app

Notepad++ URL-encoded
Get-MgBetaDeviceAppManagementMobileApp -Filter "(DisplayName eq 'PMPC - Notepad%2B%2B') and (isof('microsoft.graph.win32LobApp))
Returns no matching apps

Get-MgBetaDeviceAppManagementMobileApp -Filter "(DisplayName eq 'PMPC - Notepad%2B%2B') and isof('microsoft.graph.win32LobApp)
Returns the proper app

Test App (no +)
Get-MgBetaDeviceAppManagementMobileApp -Filter "(DisplayName eq 'PMPC - Test') and (isof('microsoft.graph.win32LobApp))
Returns the proper app

Get-MgBetaDeviceAppManagementMobileApp -Filter "(DisplayName eq 'PMPC - Test') and isof('microsoft.graph.win32LobApp)
Returns the proper app

I have tried with other combinations of filter components, including creating more complex nested filters on the right-hand side of the "and" term to see if parentheses begin working when required by syntax, but all attempts result in the same behavior. It appears that the set of parentheses is somehow causing the URI to resolve the plus to a space, while without the parentheses it properly resolves to %2B

Expected behavior

Can filter on string literals containing a '+' without having to worry about the structure of the rest of the filter query.

How to reproduce

  1. Create an app/configuration containing a "+' in the DisplayName. ie, Notepad++
  2. Use the proper Get- command to filter on that app following the structure
    Get-MgBetaX -Filter "({component 1 containing a '+' string literal}) and ({any other filter component})"

SDK Version

2.35.1

Latest version known to work for scenario above?

No response

Known Workarounds

No response

Debug output

Click to expand log ```
</details>


### Configuration

powershell 7.5.4 core, windows 10.0.26100

### Other information

_No response_

Metadata

Metadata

Assignees

No one assigned

    Labels

    status:waiting-for-triageAn issue that is yet to be reviewed or assignedtype:bugA broken experience

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions