lamw / VMware.VMC.Notification

PowerShell Module for VMware Cloud Notifications
0 stars 1 forks source link

Split-Path is reversing URL #3

Open mwstg opened 2 years ago

mwstg commented 2 years ago

Get-VMCNotificationPreference fails to parse the URL because the variable notifPreURL converts the first half of the URL to \ like

https:\vmc.vmware.com\api\notification/loggedin/user/preferences

due to the split-path function on line 756.

lamw commented 2 years ago

What operating system are you running this from? I'm not seeing this issues (MacOS) and technically it shouldn't matter on OS

The URL should have all forward slashes /

# $global:vmcNotificationGWConnection.Server2
https://vmc.vmware.com/api/notification/xxxxxxxx

# $global:vmcNotificationGWConnection.Server2 | Split-Path
https://vmc.vmware.com/api/notification

If you look at the code, it doesn't use any back slashes \ - https://github.com/lamw/VMware.VMC.Notification/blob/master/VMware.VMC.Notification.psm1#L836

mwstg commented 2 years ago

I'm in windows.

A few others appear to have the same issue with split-path reversing slashes with urls. It's easy for me to replicate it with a simple test.

Here is someone with same issue. A reply suggest this is normal for split-path which doesn't support urls but only file paths.

https://stackoverflow.com/questions/73608732/extract-left-part-of-http-uri-containing-scheme-host-and-port-everything-befor

Sent from Nine Workhttp://www.9folders.com/


From: William Lam @.***> Sent: Tuesday, September 20, 2022 8:16 PM To: lamw/VMware.VMC.Notification Cc: Matt White; Author Subject: Re: [lamw/VMware.VMC.Notification] Split-Path is reversing URL (Issue #3)

[EXTERNAL]

What operating system are you running this from? I'm not seeing this issues (MacOS) and technically it shouldn't matter on OS

The URL should have all forward slashes /

$global:vmcNotificationGWConnection.Server2

https://vmc.vmware.com/api/notification/xxxxxxxx

$global:vmcNotificationGWConnection.Server2 | Split-Path

https://vmc.vmware.com/api/notification

If you look at the code, it doesn't use any back slashes \ - https://github.com/lamw/VMware.VMC.Notification/blob/master/VMware.VMC.Notification.psm1#L836https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Flamw%2FVMware.VMC.Notification%2Fblob%2Fmaster%2FVMware.VMC.Notification.psm1%23L836&data=05%7C01%7CMWHITE%40THESUMMITGRP.COM%7C781e42be68d443b2046408da9b669304%7C1afeff1a8ad3462c8206dd62bfc0d93e%7C1%7C0%7C637993162139773442%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=6XUbMIP6O0AU%2FbM%2BMPjwtbrb8nmBl0dwjejeQ1KeVnI%3D&reserved=0

— Reply to this email directly, view it on GitHubhttps://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Flamw%2FVMware.VMC.Notification%2Fissues%2F3%23issuecomment-1253041984&data=05%7C01%7CMWHITE%40THESUMMITGRP.COM%7C781e42be68d443b2046408da9b669304%7C1afeff1a8ad3462c8206dd62bfc0d93e%7C1%7C0%7C637993162139773442%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=y25qe5NG99jzdbUEd1pYsAClC0ilO1sANUsp6MP%2Bc5Y%3D&reserved=0, or unsubscribehttps://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FA3FEEEZJ3EU24RLEAYJICXDV7JHW7ANCNFSM6AAAAAAQQFIQLU&data=05%7C01%7CMWHITE%40THESUMMITGRP.COM%7C781e42be68d443b2046408da9b669304%7C1afeff1a8ad3462c8206dd62bfc0d93e%7C1%7C0%7C637993162139773442%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=%2FCWPqbH3kY%2BFvY3humcPZ9kNz5mn%2Fkfp%2FQ0sVfohvnI%3D&reserved=0. You are receiving this because you authored the thread.Message ID: @.***>